nginx配置问题
现在一台服务器上跑了gm,web,qh,mb 4个网站,最开始只有gm,web,qh 3个。今天我加了mb之后,发现访问mb的时候,有一定几率跳到web上,不知道什么原因。 下面上配置:
upstream nodejs__upstream_gm {
server 127.0.0.1:8001 weight=1;
}
upstream nodejs__upstream_web {
server 127.0.0.1:8002 weight=1;
}
upstream nodejs__upstream_qh {
server 127.0.0.1:1337;
}
upstream nodejs__upstream_mb {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name www.域名.com;
location / {
root html;
index index.html index.htm;
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_set_header X-Nginx-Proxy true;
proxy_pass http://nodejs__upstream_web;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name gm.域名.com;
location / {
root html;
index index.html index.htm;
proxy_pass http://nodejs__upstream_gm;
client_max_body_size 10m;
client_body_buffer_size 128k;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name qh.域名.com;
location / {
root html;
index index.html index.htm;
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_set_header X-Nginx-Proxy true;
proxy_pass http://nodejs__upstream_qh;
proxy_read_timeout 10;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name mb.域名.com;
location / {
root html;
index index.html index.htm;
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_set_header X-Nginx-Proxy true;
proxy_pass http://nodejs__upstream_mb;
proxy_read_timeout 10;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
3 回复