简单易懂,只需三个步骤Ngnix + tomcat 配置负载均衡
环境Win7 Linux也一样
nginx-1.0.4
下载地址
http://nginx.org/download/nginx-1.0.4.zip
第一步
下载之后解压就能用
解压到c:\nginx-1.0.4
打开conf下ngnix.conf文件
在#gzip on;行下加入
upstream localhost { #ip_hash; #8080 8081 tomcat端口 这里两个为例 server localhost:8080; server localhost:8081; }
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 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; }