我有两个在不同的端口上运行的 Angular 应用。当用户调用时,我需要访问 app1https://网址和 app2 当用户调用https://url/admin。我尝试将位置块添加到 Nginx 配置中,如下所示,但请求被定向到添加了 /admin 的 app1。
server {
# listen 80 default_server;
# listen [::]:80 default_server ipv6only=on;
listen 443 ssl;
root /usr/share/nginx/html;
index index.html index.htm;
server_name fr.techolution.com;
ssl_certificate /etc/nginx/ssl/url_com.crt;
ssl_certificate_key /etc/nginx/ssl/myserver.key;
location / {
proxy_pass http://192.168.2.81:8083;
}
location /admin {
proxy_pass http://192.168.2.81:4200;
}
}
答案1
尝试:
location /admin {
proxy_pass http://192.168.2.81:4200;
}