server { listen 80; server_name localhost; #charset koi8-r; charset utf-8; #access_log logs/host.access.log main; # location / { # root html; # index index.html index.htm; # } #对 / 所有做负载均衡+反向代理 location / { proxy_pass http://10.121.22.171:8080; proxy_redirect off; # 后端的Web服务器可以通过X-Forwarded-For获取用户真实IP 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_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; } #静态文件 location ~* / { root /home/qtsm/imb-demo/dist; index index.html index.htm; proxy_pass http://imb; }