Back to Blog
DevOps•1 min read

Nginx as a Reverse Proxy: The Complete Setup

Scaleup Infotech Team
Scaleup Infotech Team

Custom Software & Business Automation

NginxReverse ProxyDevOpsTLS

In this guide

A simple overview of Nginx as a Reverse Proxy: The Complete Setup. Learn what it means, when it helps, and what to check first.

A reverse proxy sits between the internet and your app, handling TLS, compression, and load balancing so your application code doesn't have to. Nginx is the workhorse. Here's a solid baseline.

Proxy to Your App

nginx
server {
    listen 443 ssl http2;
    server_name app.example.com;

    ssl_certificate     /etc/letsencrypt/live/app/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/app/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Load Balance Across Instances

nginx
upstream backend {
    server 127.0.0.1:3000;
    server 127.0.0.1:3001;
    server 127.0.0.1:3002;
}
# then: proxy_pass http://backend;

Free Performance Wins

  • Enable gzip/brotli compression for text responses.
  • Serve static assets directly from Nginx with long cache headers.
  • Add rate limiting (limit_req) to blunt abusive traffic at the edge.

Always Validate

Run sudo nginx -t before every reload. A typo in a proxy block can take the whole site offline.

Relevant Scaleup Infotech Services

Share this article:

Keep Reading

Ready to implement these ideas?

Discuss Your Project