请求:
http://192.168.64.76/Shep.ElicenseWeb/Public/OutputDocuments.ashx?uinz=12009718&iinbin=860610350635
应该redirect到:
http://localhost:82/Public/OutputDocuments.ashx?uinz=12009718&iinbin=860610350635
我试过这个没有运气:
location /Shep.ElicenseWeb/ { rewrite ^/Shep.ElicenseWeb/ /$1 last; proxy_pass http://localhost:82; }
什么是正确的方式来执行这样的重写nginx?
你的重写声明是错误的。
右侧的$1表示匹配部分中的一个组(由圆括号表示)。
尝试:
rewrite ^/Shep.ElicenseWeb/(.*) /$1 break;
location /Shep.ElicenseWeb/ { proxy_pass http://localhost:82/; }
你根本不需要rewrite 。 只是/在proxy_pass结束。
请阅读文档: http : //nginx.org/r/proxy_pass