Russia
A reverse proxy sits in front of your application and forwards incoming requests to it. On a VPS, this is extremely useful because
many apps (Node.js, Python, Go, Java) run on ports like 3000, 5000, or 8080, while your public website
should be accessible on standard web ports 80 (HTTP) and 443 (HTTPS).
Nginx is one of the most popular reverse proxies in the world because it’s fast, stable, and simple to configure.
With the right setup, you can host multiple apps on one VPS (each on its own domain or subdomain), add SSL certificates,
and improve security without changing your application code.
If your app is running on a non-standard port (example: localhost:3000), users cannot easily access it with a clean domain
like example.com. A reverse proxy solves that by receiving traffic on ports 80/443 and forwarding it internally.
First, update your VPS and install Nginx. This tutorial assumes Ubuntu 22.04/24.04.
Confirm Nginx is running:
Your application should listen on a private port and on localhost (recommended), like:
127.0.0.1:3000. This keeps the app private and lets Nginx control public traffic.
Best practice: bind your app to 127.0.0.1 instead of 0.0.0.0, unless you have a reason to expose it publicly.
Nginx should be the only public entry point.
Nginx uses server blocks to define how it handles a domain. You’ll create a config file in
/etc/nginx/sites-available/ and enable it in sites-enabled.
One of the biggest benefits of Nginx reverse proxy is that you can run multiple services on the same VPS.
Each service can use its own domain or subdomain and point to a different internal port.
Don’t forget to create A records for each domain/subdomain pointing to your VPS IP.
If DNS is wrong, Nginx will never receive the traffic.
Once HTTP reverse proxy works, the next step is adding HTTPS. Let’s Encrypt provides free SSL certificates via Certbot.
Certbot can automatically update your Nginx config to use SSL and redirect HTTP → HTTPS.
Your app is not running, wrong port, or app crashed. Confirm it’s listening on 127.0.0.1:PORT and restart your app process manager.
Verify the domain points to your VPS IP (A record). DNS changes can take time to propagate.
Ensure ports 80 and 443 are open: sudo ufw allow 80 and sudo ufw allow 443.
If your server_name doesn’t match the domain in DNS, Nginx may serve the default site instead of your app.
Using Nginx as a reverse proxy is one of the most important skills for hosting modern apps on a VPS. It lets you keep your application private,
route traffic to the correct service, run multiple apps on one server, and add HTTPS without rewriting your backend.
If you want a reliable VPS to run Nginx reverse proxy setups, APIs, and containers, you can explore
Retzor VPS hosting
for scalable and developer-friendly plans.