(location =) > (location 完整路徑) > (location ^~ 路徑) > (location ~,~* 正則順序) > (location 部分起始路徑) > (/)
複製代碼
在nginx中配置proxy_pass代理轉發時html
假設下面四種狀況分別用 http://192.168.1.1/proxy/test.html
進行訪問。nginx
# 代理到URL:http://127.0.0.1/test.html
location /proxy/ {
proxy_pass http://127.0.0.1/;
}
複製代碼
# 代理到URL:http://127.0.0.1/proxy/test.html
location /proxy/ {
proxy_pass http://127.0.0.1;
}
複製代碼
# 代理到URL:http://127.0.0.1/aaa/test.html
location /proxy/ {
proxy_pass http://127.0.0.1/aaa/;
}
複製代碼
# 代理到URL:http://127.0.0.1/aaatest.html
location /proxy/ {
proxy_pass http://127.0.0.1/aaa;
}
複製代碼