One, reverse proxy
Description: There should be an Nginx server with multiple application servers (which can be Tomcat), this article uses a virtual machine, installs an nginx, multiple tomcat, to simulate
Upstream Tomcats{server 192.168.25.148:8080;server 192.168.25.148:8081;} server { listen ; server_name tomcat.taotao.com; #charset Koi8-r; #access_log logs/host.access.log main; Location/{ proxy_pass http://tomcats; Index index.html index.htm; }}
Second, load Balancing
Note: You only need to add a weight behind the upstream server to represent the weights. The higher the weight, the more the number of allocation requests. The default weight is 1
Upstream tomcats{server 192.168.0.11:8080 weight=2;server 192.168.0.11:8081;} server { listen ; server_name tomcat.taotao.com; #charset Koi8-r; #access_log logs/host.access.log main; Location/{ proxy_pass http://tomcats; Index index.html index.htm; }}
At this point the simple nginx reverse proxy and load balancer configuration end ...
Nginx configuration reverse proxy and load balancer