S
S
Saharman2019-01-19 12:06:38
Nginx
Saharman, 2019-01-19 12:06:38

How to host two ASP projects with nginx?

There are two ASP.NET Core projects, one daemon on localhost:5000, the other on localhost:5010. I wanted to make it so that when accessing my_site.ru, localhost:5000 was returned, and when accessing my_site.ru/test, localhost:5010 was returned. At the moment, when accessing my_site.ru, everything works, but when my_site.ru/test does not produce anything.

server {
    listen        80;
    server_name  my_site.ru ;
    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;
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question