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