February 2018
Beginner to intermediate
348 pages
9h 40m
English
The implementation of load balancing in Nginx is particularly clever, as it allows you to distribute a load at several levels of your infrastructure. It isn't limited to proxying HTTP requests across backend servers: it also offers to distribute requests across FastCGI backends (FastCGI, uWSGI, SCGI, and more), or even distribute queries to Memcached servers. Any directive that ends with _pass, such as proxy_pass, fastcgi_pass, or memcached_pass, accepts a reference to a group of servers.
The first step is to declare this group of servers with the help of the upstream block, which must be placed within the http block. Within the upstream block, declare one or more servers with the server directive:
http { upstream MyUpstream ...