今天有一个需求,要根据上下文调到不同的ip或域名地址,使用上下文做域名跳转的时候,proxy_pass域名后面一定要带‘/’否则会把nginx的上下文自动带入,这样就行。
location ^~ /docs/ {
            root   html;
            add_header Cache-Control no-store;
            add_header ‘Access-Control-Allow-Origin‘ ‘*‘;
            index  index.html index.htm;
            proxy_pass http://47.92.128.109:8080/;
        }
        location / {
            root   html;
            add_header Cache-Control no-store;
            add_header ‘Access-Control-Allow-Origin‘ ‘*‘;
            index  index.html index.htm;
            proxy_pass http://cg.haier.net;
        }
原文:https://www.cnblogs.com/dayangcong/p/8810282.html