The last two lectures are mainly about the nginx environment, which does not involve the development of the real environment. In this example, describe how to configure nginx for the Server Load balancer and WWW server and how to implement it.
The following is an actual scenario: One Server Load balancer server, and two www servers Client1 and Client2. data between B and C is synchronized. You can use a third-party software for synchronization.
The configuration of nginx. conf on the server side is as follows:
upstream www.zzl.com { server 192.168.2.72:80; server 192.168.2.4:80; server 192.168.2.5:80;} server { listen 80; server_name www.zzl.com; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://www.zzl.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
The configurations of Client1 and Client2 are as follows:
server { listen 80; server_name www.zzl.com;
OK. After setting, load your nginx reload nginx-s reload.
This is the success !!!
Nginx series ~ Implementation of Server Load balancer and WWW Server