DEV Community

Tech Gard pro
Tech Gard pro

Posted on Originally published at mobilestuff2026.blogspot.com

Quick Guide: Nginx Reverse Proxy & Load Balancer Setup on Ubuntu 24.04

Looking to secure your backend services or distribute traffic across multiple servers using Nginx? Here is a quick configuration reference for Ubuntu 24.04 LTS.


1. Reverse Proxy Snippet

Route incoming port 80 traffic to a local app running on port 3000:


nginx
server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass [http://127.0.0.1:3000](http://127.0.0.1:3000);
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
2. Load Balancer Snippet
Distribute requests across multiple upstream backend nodes using Round-Robin:upstream backend_servers {
    server 10.0.0.1:8080;
    server 10.0.0.2:8080;
}

server {
    listen 80;
    server_name loadbalancer.yourdomain.com;

    location / {
        proxy_pass http://backend_servers;
    }
}
📖 Want the complete step-by-step setup guide including SSL configuration with Let's Encrypt?
👉 Read the Full Step-by-Step Guide on My Blog 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)