<Server port="8005" shutdown="SHUTDOWN"> 改成 <Server port="18005" shutdown="SHUTDOWN">(端口号随便) <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> 改成 <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 改成 <Connector port="18009" protocol="AJP/1.3" redirectPort="8443" />
<Server port="18006" shutdown="SHUTDOWN">(端口号随便) ........... <Connector port="18081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> ........... <Connector port="18010" protocol="AJP/1.3" redirectPort="8443" />
sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65;
upstream localhost { server localhost:18080; server localhost:18081; #ip_hash; }
location / { root html; index index.html index.htm;
proxy_pass http://localhost; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 15; proxy_send_timeout 15; proxy_read_timeout 15; proxy_buffer_size 8k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k;
location / { root html; index index.html index.htm; proxy_pass http://localhost; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 15; proxy_send_timeout 15; proxy_read_timeout 15; proxy_buffer_size 8k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k; }
这样,nginx+tomcat负载均衡就全部搞定了。
我的博客其他文章列表
http://my.oschina.net/helu