如何使用Nginx部署两个ASP项目?

时间:2019-01-20 08:35:25

标签: asp.net nginx

我有两个项目:localhost:5000和localhost:5010上。如果我进入my_site.com,则要打开localhost:5000,并要在my_site.com/test上打开localhost:5010。这第一个项目是开放的,但不是第二个。我该如何解决我的问题?

server {
listen        80;
server_name  my_site.com ;
location / {
    proxy_pass         http://localhost:5000;
    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;
}
location /test {
        proxy_pass         http://localhost:5010;
        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 个答案:

没有答案