nginx在配置proxy_pass的时候 URL结尾加斜线(/)与不加的区别和注意事项
假设访问路径的 /pss/bill.html
加/斜线的情况
location /pss/ {
proxy_pass http://127.0.0.1:18081/;
}
被代理的真实访问路径为:http://127.0.0.1:18081/bill.html
不加/斜线的情况
location /pss/ {
proxy_pass http://127.0.0.1:18081;
}
被代理的真实访问路径为:http://127.0.0.1:18081/pss/bill.html
Nginx配置proxy_pass加/与不加/的区别
博客介绍了nginx在配置proxy_pass时,URL结尾加斜线(/)与不加的区别及注意事项。以访问路径/pss/bill.html为例,加/时被代理的真实访问路径为http://127.0.0.1:18081/bill.html,不加/时为http://127.0.0.1:18081/pss/bill.html。
1419

被折叠的 条评论
为什么被折叠?



