【发布时间】:2019-06-01 07:18:44
【问题描述】:
今天用了两台服务器做nginx,nginx.conf的内容如下:
#192.168.2.98
server {
listen 8091;
location ^~ /ttank {
alias /develop/servers-running/front/vue-public/dist;
index index.html;
try_files $uri $uri/ /ttank/index.html;
}
}
#192.168.2.97
location /ttank {
proxy_pass http://192.168.2.98:8091;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
我可以通过在chrome中输入地址:http://192.168.2.98:8091/ttank访问192.168.2.98:8091/ttank,我也可以访问192.168.2.98 em> 的 ttank 通过输入地址 http://192.168.2.97/ttank/,但是当我将地址 http://192.168.2.97/ttank/ 更改为 http://192.168.2.97/ttank 时,我的 chrome永远进入等待状态,两个地址唯一的区别就是最后一个“/”,ttank访问ttank时不知道怎么修改配置文件去掉最后一个“/” >192.168.2.97?
【问题讨论】:
标签: nginx vue.js nginx-location nginx-reverse-proxy