DevOps & Deployment December 22, 2025 1 min read

Setting Up Nginx as Load Balancer

Configure Nginx to distribute traffic across multiple servers.

A
Ahmed Hassan
Software engineer with expertise in backend systems
16 views

Table of Contents

  • Loading table of contents...

Nginx Load Balancing

Distribute traffic for high availability and performance.

Configuration

upstream backend {
    least_conn;
    server 192.168.1.10:8000;
    server 192.168.1.11:8000;
    server 192.168.1.12:8000;
}

server {
    listen 80;
    location / {
        proxy_pass http://backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Algorithms

  • round-robin - Default
  • least_conn - Least connections
  • ip_hash - Client IP based

Related Articles

Discussion 0

No comments yet. Be the first to start the discussion!

Leave a Comment