今天遇到的问题,记录一下:
访问的请求:http://192.168.1.4/api/hello
proxy_pass中的url 加/
情况一
location /api/ {
proxy_pass http://localhost:8080/;
}
代理结果
http://localhost:8080/hello
情况二
location /api/ {
proxy_pass http://localhost:8080/module1/;
}
代理结果
http://localhost:8080/module1/hello
proxy_pass中的url 不加/
情况一
location /api/ {
proxy_pass http://localhost:8080;
}
代理结果
http://localhost:8080/api/hello
情况二
location /api/ {
proxy_pass http://localhost:8080/module1;
}
代理结果
http://localhost:8080/module1hello