【发布时间】:2018-07-18 23:29:28
【问题描述】:
我正在关注这个tutorial,一切正常,直到我尝试使用多个位置,例如:
location /app1 {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /app2 {
proxy_pass http://localhost:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
当我尝试调用它们时,它不会重定向并返回 404。
如果我这样做,它可以工作,但这样我只能使用一个应用程序,这不是我想要的......
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
谁能帮帮我?
【问题讨论】:
-
或许
/app1/? -
不敢相信事情这么简单!有效!谢谢!!!
-
哈哈,太棒了!很高兴听到这个消息!
标签: nginx location reverse-proxy