Load balancing with Nginx

Are you looking forward to balance HTTP or HTTPS traffic to multiple back-end servers? Nginx is one of the best choices – it’s very lightweight, requires less resources and it’s completely free.

You need to compile the nginx (there are many resources and howto’s) and add the following lines to your nginx.conf file:

upstream webcluster {
server 10.10.10.1;
server 10.10.10.2
server 10.10.10.3;
}

location / {
proxy_pass http://webcluster;
break;
}

Where 10.10.10.1, 10.10.10.2, 10.10.10.3 are the back-end web servers located in internal network defined in upstream settings above. The location / specifies that all URLs should be balanced to back-end servers.

Many folks prefer to serve HTTPS traffic with nginx and then forward all requests via HTTP protocol to the back-end servers. The back-end servers should be located on a safe VLAN or internal network.


Comments

  1. Alex says:

    It’s a damn fast web server with so low load. 200% recommended!

Leave a Reply