Skip to content

Using NGINX as a Reverse Proxy

NGINX · Self-help guide

One of the most powerful uses of NGINX is reverse proxying. This means NGINX receives public web traffic on port 80 or 443, then forwards it internally to another service running on the same server or a private backend server. This is very common for Laravel Octane, Node.js apps, Docker containers, radio panels, API services, dashboards, and admin tools.

For example, your app might be running on:

http://127.0.0.1:3000

Instead of asking users to visit that port directly, you configure NGINX so visitors use:

https://app.example.com

Step 1: Make sure your backend application is running locally.

Step 2: Create a new NGINX server block for the domain or subdomain.

Step 3: Add a location block that uses proxy_pass to forward requests to the internal service.

Step 4: Include proxy headers so the backend app knows the original visitor IP, host, and protocol.

Step 5: Test NGINX:

sudo nginx -t

Step 6: Reload NGINX:

sudo systemctl reload nginx

Useful troubleshooting checks:

curl -I http://127.0.0.1:3000 sudo systemctl status nginx sudo journalctl -u nginx —no-pager -n 50 sudo tail -f /var/log/nginx/error.log

If the backend is down, NGINX may show 502 Bad Gateway. That usually means NGINX is working, but the application it is proxying to is not responding. Check the app service, port number, firewall, and local bind address. For security, backend apps should often listen on 127.0.0.1 rather than 0.0.0.0 unless you specifically need external access.

Did this solve it?If not, Penny and the support team are ready to help.Start live chatOpen a ticket