location ^~ /static_js/
{
proxy_cache js_cache;
proxy_set_header Host www.server110.com;
proxy_pass http://www.server110.com/;
}
如上面的配置,如果请求的url是http://servername/static_js/88181.html
会被代理成http://www.server110.com/88181.html
而如果这么配置
location ^~ /static_js/
{
proxy_cache js_cache;
proxy_set_header Host www.server110.com;
proxy_pass http://www.server110.com;
}
则会被代理到http://www.server110.com/static_js/88181.htm
当然,我们可以用如下的rewrite来实现/的功能
location ^~ /static_js/
{
proxy_cache js_cache;
proxy_set_header Host www.server110.com;
rewrite /static_js/(.+)$ /$1 break;
proxy_pass http://www.server110.com;
}