我正在遵循此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;
}
有人可以帮助我吗?
答案 0 :(得分:0)
根据我们在评论中的讨论:/app1/
;)