使用 Nginx 重新導向到兩個端口

使用 Nginx 重新導向到兩個端口

我有兩個在不同連接埠上運行的角度應用程式。當用戶呼叫時我需要訪問app1https://網址當用戶呼叫時app2https://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;
}

相關內容