nginx 的proxy_pass 基本设置问题GOOD
2014-03-29 14:17
375 查看
曾在网上看到一些问题,比如 nginx 的proxy_pass后面的地址加“/”与不加“/”有区别。
参看nginx英文文档后,发现:
If it is necessary to transmit URI in the unprocessed form then directive proxy_pass should be used without URI part:
location /some/path/ {
proxy_pass http://127.0.0.1;
}
大概意思就是说,如果你不想nginx对你的URI请求有任何形式的修改,那么,proxy_pass的配置中就不应该有任何URI部分。
举个例子,nginx服务器IP为10.0.0.20,它的配置不含URI:
location /first/second/ {
proxy_pass http://10.0.0.30:90;
}
那么,
原: http://10.0.0.20/first/second/test.html
转:http://10.0.0.30:90/first/second/test.html
割一下,如果配置成含URI:
location /first/second/ {
proxy_pass http://10.0.0.30:90/myuri;
}
那么,
原: http://10.0.0.20/first/second/test.html
转:http://10.0.0.30:90/myuri/test.html
简单地说,配置了URI之后,跳转行为可能会令你感到莫名其妙,要有充分的思想准备。
参看nginx英文文档后,发现:
If it is necessary to transmit URI in the unprocessed form then directive proxy_pass should be used without URI part:
location /some/path/ {
proxy_pass http://127.0.0.1;
}
大概意思就是说,如果你不想nginx对你的URI请求有任何形式的修改,那么,proxy_pass的配置中就不应该有任何URI部分。
举个例子,nginx服务器IP为10.0.0.20,它的配置不含URI:
location /first/second/ {
proxy_pass http://10.0.0.30:90;
}
那么,
原: http://10.0.0.20/first/second/test.html
转:http://10.0.0.30:90/first/second/test.html
割一下,如果配置成含URI:
location /first/second/ {
proxy_pass http://10.0.0.30:90/myuri;
}
那么,
原: http://10.0.0.20/first/second/test.html
转:http://10.0.0.30:90/myuri/test.html
简单地说,配置了URI之后,跳转行为可能会令你感到莫名其妙,要有充分的思想准备。
相关文章推荐
- nginx 的proxy_pass 基本设置问题
- nginx 的proxy_pass 基本设置问题
- nginx的proxy_pass 基本设置问题
- nginx 的proxy_pass 基本设置问题
- nginx 的proxy_pass 基本设置问题
- nginx 的proxy_pass 基本设置问题
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass转发的/路径问题
- 解决nginx使用proxy_pass反向代理时,session丢失的问题
- nginx反向代理(proxy_pass)tomcat的过程中,session失效的问题解决
- nginx的proxy_pass路径转发规则浅析(末尾/问题)
- 解决nginx使用proxy_pass反向代理时,cookie丢失的问题
- nginx 代理 proxy_pass设置
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass转发的/路径问题
- 解决nginx中proxy_pass到tomcat的session丢失问题
- 记一次nginx中proxy_pass的使用问题
- 关于设置Nginx与vsftpd时遇到的问题总结...每天基本都会遇到问题..一点一点总结吧
- Nginx配置proxy_pass转发的/路径问题
- Nginx配置proxy_pass的/路径问题