Сервер: Ubuntu 18 + nginx + apache Установлен dotnet для Ubuntu
Создал /etc/nginx/sites-available/domen1.conf:
server {
listen 80;
server_name domen1 www.domen1;
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;
}
}
Создал и запустил сервис /etc/systemd/system/kestrel-ASP-NET-core-
myApp1.service:
[Unit]
Description=myApp1 .NET Core Web API App running on Ubuntu
[Service]
WorkingDirectory=/home/www/ASP.NET.core/myApp1
ExecStart=/usr/bin/dotnet /home/www/ASP.NET.core/myApp1/myApp1.dll
Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=dotnet-ASP-NET-core-myApp1
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Все работает.
Но когда я хочу добавить еще один сайт на ASP.NET Core:
Создал /etc/nginx/sites-available/domen2.conf:
server {
listen 80;
server_name domen2 www.domen2;
location / {
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;
}
}
Создал и запустил сервис /etc/systemd/system/kestrel-ASP-NET-core-
myApp2.service:
[Unit]
Description=myApp2 .NET Core Web API App running on Ubuntu
[Service]
WorkingDirectory=/home/www/ASP.NET.core/myApp2
ExecStart=/usr/bin/dotnet /home/www/ASP.NET.core/myApp2/myApp2.dll
Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=dotnet-ASP-NET-core-myApp2
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Второй сайт не работает. Я понимаю, что надо дать какую-то команду на прослушивание порта 5010 - как это сделать?