我的Nginx如何在具有不同.net核心应用程序的端口8880和80上工作

时间:2019-04-05 12:50:54

标签: .net nginx amazon-ec2 .net-core

我在Amazon Ec2实例上运行我的服务器,并在其上运行nginx服务器。

我在这个实例上有2个项目

我在站点中可用的nginx默认文件是这样的

服务器1

server { 
    listen       80;
    server_name  0.0.0.0;
    location / {
        proxy_pass         http://localhost:5005/;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

服务器2

server { 
    listen       8880;
    server_name  0.0.0.0;
    location / {
        proxy_pass         https://localhost:5001/;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

0 个答案:

没有答案