运维:Nginx Location if语句中proxy_pass 不支持/context 虚拟路径的解决方案。
请看官方的说明,你可以找到思路 ^_^A special case is using variables in the proxy_pass statement: The requested URL is not used and you are fully responsible to construct the target URL yourself.
This means, the following is not what you want for rewriting into a zope virtual host monster, as it will proxy always to the same URL (within one server specification):
location / {
proxy_pass http://127.0.0.1:8080/VirtualHostBase/https/$server_name:443/some/path/VirtualHostRoot;
}
Instead use a combination of rewrite and proxy_pass:
location / {
rewrite ^(.*)$ /VirtualHostBase/https/$server_name:443/some/path/VirtualHostRoot$1 break;
proxy_pass http://127.0.0.1:8080;
}
http://wiki.nginx.org/HttpProxyModule
页:
[1]