nginx配置加载angular6应用程序作为主应用程序的模块

nginx配置加载angular6应用程序作为主应用程序的模块,nginx,nginx-location,Nginx,Nginx Location,我需要angular6应用程序处理对app.com/blah/*的所有请求,但对app.com/*的所有其他请求都需要tomcat处理。我将向一个已经存在的应用程序添加一个模块 以下配置的问题是:location/覆盖整个配置,并导致所有请求都由tomcat处理 请参阅下面的配置 server { listen 80; server_name staging.app.com; root /las/blah/app; client_max_body_size 980M; include /etc/

我需要angular6应用程序处理对app.com/blah/*的所有请求,但对app.com/*的所有其他请求都需要tomcat处理。我将向一个已经存在的应用程序添加一个模块

以下配置的问题是:location/覆盖整个配置,并导致所有请求都由tomcat处理

请参阅下面的配置

server {
listen 80;
server_name staging.app.com;
root /las/blah/app;
client_max_body_size 980M;
include /etc/nginx/default.d/*.conf;

   location ^~ /blah/ {
           try_files $uri /index.html;
   }

    location / {
           proxy_pass http://localhost:8080;
           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_set_header X-Forwarded-Proto $scheme;
   }

error_page 404 /404.html;
       location = /40x.html {
   }

error_page 500 502 503 504 /50x.html;
       location = /50x.html {
   }
}


请帮助我,这就是我解决问题的方法

location ^~ /blah {
       alias   /las/blah/app;
       try_files $uri /blah/index.html;
    }

键是alias。

其中是
/index.html
?现在它是从tomcat那里取来的。要么把它放在
/blah
下面,要么为它添加一个特定的位置。@RichardSmith,不清楚你的建议是什么。