nginx中斜杠(/)详解
location、proxy_pass都不加斜杠
location /v1 {
proxy_pass http://127.0.0.1:8899;
}
#实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
location加斜杠、proxy_pass不加斜杠
location /v1/ {
proxy_pass http://127.0.0.1:8899;
}
#实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
location不加斜杠、proxy_pass加斜杠
location /v1 {
proxy_pass http://127.0.0.1:8899/;
}
#实际访问代理地址:http://127.0.0.1:8899//pt/apply/page
#其实是把location的v1截断了
location、proxy_pass都加斜杠
location /v1/ {
proxy_pass http://127.0.0.1:8899/;
}
#实际访问代理地址:http://127.0.0.1:8899/pt/apply/page
#把location下面的v1截断了
location不加斜杠,proxy_pass加"v1"
location /v1 {
proxy_pass http://127.0.0.1:8899/v1;
}
#实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
location加斜杠,proxy_pass加"v1"
proxy_pass http://127.0.0.1:8899/v1;
}
#实际访问代理地址:http://127.0.0.1:8899/v1pt/apply/page
location不加斜杠,proxy_pass加"v1/"
location /v1 {
proxy_pass http://127.0.0.1:8899/v1/;
}
#实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
location加斜杠,proxy_pass加"v1/"
location /v1/ {
proxy_pass http://127.0.0.1:8899/v1/;
}
#实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
网友评论