nginx反向代理配置
proxy_pass 无后缀
location 无 / ;proxy_pass无 /
location /test {
proxy_pass http://192.168.2.96:8087;
}
1、访问:http://127.0.0.1/test
重定向到: http://192.168.2.96:8087/test
2、访问: http://127.0.0.1/test/
重定向到: http://192.168.2.96:8087/test/
3、访问:http://127.0.0.1/test/login
重定向到: http://192.168.2.96:8087/test/login
location 有 / ;proxy_pass无 /
location /test/ {
proxy_pass http://192.168.2.96:8087;
}
1、访问:http://127.0.0.1/test
重定向到: http://127.0.0.1/test/
2、访问:http://127.0.0.1/test/
重定向到:http://192.168.2.96:8087/
3、访问:http://127.0.0.1/test/login
重定向到:http://192.168.2.96:8087/login
location 无 / ;proxy_pass有 /
location /test{
proxy_pass http://192.168.2.96:8087/;
}
1、访问:http://127.0.0.1/test
重定向到: http://192.168.2.96:8087/
2、访问: http://127.0.0.1/test/
重定向到: http://192.168.2.96:8087//
3、访问:http://127.0.0.1/test/login
重定向到: http://192.168.2.96:8087//login
location 有 / ;proxy_pass有 /
location /test/ {
proxy_pass http://192.168.2.96:8087/;
}
1、访问:http://127.0.0.1/test
重定向到: http://127.0.0.1/test/
2、访问:http://127.0.0.1/test/
重定向到:http://192.168.2.96:8087/
3、访问:http://127.0.0.1/test/login
重定向到:http://192.168.2.96:8087/login
proxy_pass 有后缀
location 无 / ;proxy_pass无 /
location /test{
proxy_pass http://192.168.2.96:8087/define;
}
1、访问:http://127.0.0.1/test
重定向到: http://192.168.2.96:8087/define
2、访问: http://127.0.0.1/test/
重定向到: http://192.168.2.96:8087/define/
3、访问:http://127.0.0.1/test/login
重定向到: http://192.168.2.96:8087/define/login
location 有 / ;proxy_pass无 /
location /test/ {
proxy_pass http://192.168.2.96:8087/define;
}
1、访问:http://127.0.0.1/test
重定向到: http://192.168.2.96/test/
2、访问:http://127.0.0.1/test/
重定向到:http://192.168.2.96:8087/define
3、访问:http://127.0.0.1/test/login
#define与login之间不会有/ ,会直接拼接起来
重定向到:http://192.168.2.96:8087/definelogin
location 无 / ;proxy_pass有 /
location /test {
proxy_pass http://192.168.2.96:8087/define/;
}
1、访问:http://127.0.0.1/test
重定向到: http://192.168.2.96:8087/define/
2、访问: http://127.0.0.1/test/
重定向到: http://192.168.2.96:8087/define//
3、访问:http://127.0.0.1/test/login
重定向到: http://192.168.2.96:8087/define//login
location 有 / ;proxy_pass有 /
location /test/ {
proxy_pass http://192.168.2.96:8087/define/;
}
1、访问:http://127.0.0.1/test
重定向到: http://127.0.0.1/test/
2、访问: http://127.0.0.1/test/
重定向到: http://192.168.2.96:8087/define/
3、访问:http://127.0.0.1/test/login
重定向到: http://192.168.2.96:8087/define/login