Nginx server load balancing configuration
CentOS Nginx is currently recognized as a highly efficient proxy service, and can be used for load balancing. user access www.server110.com balances to 10.10.10.181:8080; 10.10.10.181:8081; 10.10.10.181:8082 these 3 servers. Configure CentOS Nginx nginx.conf http {} add the following content upstream www.server110.com {server 10.10.10.181:8080; server 10.10.10.181:8081; server 10.10.10.181:8082; } server {} Modify Yixia information: listen 80; server_name www.server110.com; #charset koi8-r; #access_log logs/host_access_log main; location / { proxy_pass http://www.server110.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 } access_log logs/www.server110.com.log combined; the [/code] Start 3 tomcats on 181, modify the tomcat home page to add port information, so as to clearly see which tomcat is currently assigned to start Nginx, visit http://www.server110.com/ You can see that the request is sent to 3 servers. Catch the http package and you can see that the request is GET / HTTP/1.1 Host: www.server110.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 the Accept: text/html, application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8 the Accept-Language: en-us,zh-cn;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive COOKIE: JSESSIONID=A75E09D2EBF769A7BD95195E29DE87DE; key=1227008000183; memberName=admin; memberType=%7C%u8D85%u7EA7%u7BA1%u7406%u5458%7C the Pragma: no-cache Cache-Control: no-cache response: HTTP/1.1 200 OK Server: nginx/0.7.21-win32 Date: Tue, 18 Nov 2008 12:12:33 GMT the Content-Type: text/html Connection: keep-alive