转载:nginx proxy_pass 里的”/”

来源:互联网 发布:汽车单片机技术讲解 编辑:程序博客网 时间:2024/04/24 05:40

http://www.cnblogs.com/naniannayue/archive/2010/08/07/1794520.html


PS: 如果是 location ~* ^/start/(.*)\.html 这种正则的location,是不能写”/”上去的,nginx -t 也会报错的了。因为,路径都需要正则匹配了嘛,并不是一个相对固定的locatin了,必然要代理到一个server。



http://www.cnblogs.com/AloneSword/p/3673829.html


当然,我们可以用如下的rewrite来实现/的功能

location ^~ /static_js/ 

proxy_cache js_cache; 
proxy_set_header Host js.test.com; 
rewrite /static_js/(.+)$ /$1 break; 
proxy_pass http://js.test.com; 


http://serverfault.com/questions/379675/nginx-reverse-proxy-url-rewrite

0 0
原创粉丝点击