Nginx 不会重定向多个位置

Nginx doesn't redirect mutilple locations

我正在关注这个 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;
}

当我尝试呼叫它们时,它不会重定向并且 returns 一个 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/ ;)