Nginx Load Balancer Configuration

Nginx's upstream module turns it into a powerful software load balancer. Define your backend pool, pick a balancing strategy, and let our generator build the config block for you.

An upstream block

List the backends in an upstream and proxy_pass to it. Round-robin is the default.

upstream app {
    least_conn;
    server 10.0.0.1:8080;
    server 10.0.0.2:8080;
}
server {
    location / { proxy_pass http://app; }
}

Choosing a method

round-robin spreads requests evenly, least_conn favors the backend with fewest active connections, and ip_hash pins a client to one backend, which helps when sessions are stored locally.

Open the Load balancer generator

Frequently asked questions

Does open-source Nginx do active health checks?

No. It marks a server failed passively via max_fails and fail_timeout. Active health checks need Nginx Plus or an external checker.

How do I take a backend out of rotation?

Add the down parameter to its server line and reload Nginx.

Guides