#test
# 修改/etc/nginx/sites-enabled/default
#注意端口和目录跟你自己的实际情况一致
upstream foxback{
#server 127.0.0.1:8010 fail_timeout=2s max_fails=3;
server 127.0.0.1:3000;
server 127.0.0.1:3001 backup;
}
server{
listen 80;
client_max_body_size 20M;
server_name localhost ;
location / {
add_header Cache-Control max-age=17200;
root /home/liyusen/jg/wm/fox/client;
index index.html index.htm;
}
location ^~/b/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://foxback/;
proxy_redirect off;
add_header Access-Control-Allow-Origin "*";
}
#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;
}
}
#做完后在ubuntu下 sudo service nginx reload重新启动nginx,或者先stop再start.