1、假设server_name为www.xxx.com
当请求http://www.xxx.com/aming/a.html的时候,以上示例分别访问的结果是
示例1:
location /amazing/ {
proxy_pass http://192.168.1.10;
...
}
结果1:http://192.168.1.10/aming/a.html
示例2:
location /amazing/ {
proxy_pass http://192.168.1.10/;
...
}
结果2:http://192.168.1.10/a.html
示例3:
location /amazing/ {
proxy_pass http://192.168.1.10/linux/;
...
}
结果3:http://192.168.1.10/linux/a.html
示例4:
location /amazing/ {
proxy_pass http://192.168.1.10/linux;
...
}
结果4:http://192.168.1.10/linuxa.html
2、在配置 nacos 域名访问时,一开始这样配置的
location / {
proxy_pass http://192.168.1.10/nacos;
...
}
然后访问域名,就报 “将您重定向的次数过多” 到错误。
/ 后面的nacos是一个目录,后面应该用 / 结尾
location / {
proxy_pass http://192.168.1.10/nacos/;
...
}
3、建议所有的 proxy_pass 后的url都以“/”结尾。
proxy_pass http://192.168.1.10/linux/;