我原来是这么配置的
upstream web.xxx.com {
sticky;
server 192.168.1.171:8080 max_fails=1 fail_timeout=10s;
server 192.168.1.175:8080 max_fails=1 fail_timeout=10s;
}
server {
listen 80;
server_name web.xxx.com;
location / {
proxy_pass http://web.xxx.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;
proxy_connect_timeout 1;
proxy_read_timeout 30;
}
location /img {
root /usr/local/www/nginx;
proxy_connect_timeout 1;
proxy_read_timeout 10;
}
rewrite ^(.*)\;jsessionid=(.*)$ $1 break;
underscores_in_headers on;
}
现在 我新加了个server
server {
listen 80;
server_name store.xxx.com;
location / {
proxy_pass http://192.168.1.171:8080/store/;
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;
proxy_connect_timeout 1;
proxy_read_timeout 30; }
location /img {
root /usr/local/www/nginx;
proxy_connect_timeout 1;
proxy_read_timeout 10;
}
rewrite ^(.*)\;jsessionid=(.*)$ $1 break;
underscores_in_headers on;
}