Example of an nginx load balancer configuration. The configuration examples for load balancing are as follows:
Http{ upstream server { server 192.168.10.100:80 weight=3 max_fails=3 fail_timeout=25s; server 192.168.10.101:80 weight=1 max_fails=3 fail_timeout=25s; server 192.168.10.102:80 weight=4 max_fails=3 fail_timeout=25s; server 192.168.10.103:80 weight=2 max_fails=3 fail_timeout=25s; } server { listen 80; server_name ; index index.htm index.html; root /d21414/web/ Www;location / { proxy_pass proxy_ next_upstream http_500 http_502 http_503 error timeout invalid_headerl include /etc/nginx/proxy.conf; } }}
Note:
Configure load Balancing using the Nginx keyword to identify the upstream. A Load Balancer server server (name is optional) is specified through upstream.
2. Use the Proxy_next_upstream parameter to define the fault error. When a node returns an error such as 500. Upstream will be forwarded to weight (the higher the weight value, the higher the access probability assigned).
This article from "10998982" blog, declined reprint!
Nginx Load Balancer Configuration Example