Nginx配置proxy_pass时的注意事项
2014-07-17 23:29
666 查看
下面分别用http://192.168.1.10/test/test.php进行访问:
1. location /test/ {
proxy_pass http://192.168.1.11;
}
会被代理到 http://192.168.1.11/test/test.php 这个url
2. location /test/ {
proxy_pass http://192.168.1.11/;
}
会被代理到 http://192.168.1.11/test.php 这个url
上面两种配置,区别只在于proxy_pass转发的路径后是否带 “/”。
在nginx中配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走。
1. location /test/ {
proxy_pass http://192.168.1.11;
}
会被代理到 http://192.168.1.11/test/test.php 这个url
2. location /test/ {
proxy_pass http://192.168.1.11/;
}
会被代理到 http://192.168.1.11/test.php 这个url
上面两种配置,区别只在于proxy_pass转发的路径后是否带 “/”。
在nginx中配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走。
相关文章推荐
- Ubuntu 14.04 配置 Nginx + uWSGI 托管 virtualenv 下 Flask 应用的一点注意事项
- Nginx配置proxy_pass
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass转发的/路径问题
- nginx代理配置注意事项
- nginx配置注意事项1
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass转发的/路径
- 关于Nginx location中配置proxy_pass转发时斜线'/'导致的404问题
- Nginx中ip_hash负载均衡中location的proxy_pass配置与说明
- nginx配置注意事项2
- Nginx中ip_hash负载均衡中location的proxy_pass配置与说明
- Nginx配置proxy_pass
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass的/路径问题
- 配置nginx代理服务器的几个注意事项
- Nginx的proxy_pass配置
- SSL在tomcat上的配置,nginx上的简单配置。及其注意事项