> Linux服务器 > nginx >

Nginx Proxy细节问题

1.rewrite使用break结,使用last会对server标签重新发起请求

location /a/ {
    rewrite ^/a/(.*)$ /b/$1 break;
    proxy_pass http://www.it.net.cn;
}




2.proxy_pass结尾添加/会丢弃路径目录,如下访问/a/test.html会代理到/test.html

location /a/ {
    rewrite ^/a/(.*)$ /b/$1 break;
    proxy_pass http://www.it.net.cn/;
}




3.代理访问重定向的网址:
proxy_redirect http://www.it.net.cn/ http://$host/; (责任编辑:IT)