nginx 反向代理 之参数转发
举个栗子
server { listen 80; client_max_body_size 10M; location / { root /root/; index index.html; } location /user { proxy_pass http://127.0.0.1:10010/user/; } #location /user { # proxy_pass http://127.0.0.1:10010/user; #} #location /user/ { #proxy_pass http://127.0.0.1:10010/user/; #} #location /user/ { #proxy_pass http://127.0.0.1:10010/user; #} }
上面四种配置面对请求:http://127.0.0.1/user/abc
得出的转发结果是:
http://127.0.0.1:10010/user//abc
http://127.0.0.1:10010/user/abc
http://127.0.0.1:10010/user/abc
http://127.0.0.1:10010/userabc
面对请求:http://127.0.0.1/userabc
http://127.0.0.1:10010/zabbix/abc
http://127.0.0.1:10010/zabbixabc
404
404
不同的路由方式转发的内容也是不一样的