nginx 配置proxy_pass代理转发的时候,加/ 和不加 / 的区别: 如果后面的url加 /,表示绝对根路径;如果没有/,表示相对路径
1、加/
server_name test.com
location /data/ {
proxy_pass http://127.0.0.1/;
}
访问test.com/data/index.html 会转发到 http://127.0.0.1/index.html
2、不加/
server_name test.com
location /data/ {
proxy_pass http://127.0.0.1;
}
访问test.com/data/index.html 会转发到http://127.0.0.1/data/index.html
nginx配置proxy_pass反向代理时,加/和不加/的区别
最新推荐文章于 2024-04-16 17:20:07 发布