У меня есть следующее в файле конфигурации по умолчанию в папке / etc / nginx / sites-available
server {
listen 80;
location / {
proxy_pass http://10.XX.XX.XX: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_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 81;
location / {
proxy_pass http://10.XX.XX.XX:5050;
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_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
это работает http://10.XX.XX.XX/ и показывает страницу .net Core (ProjectA)
, но
Это не работает http://10.XX.XX.XX:81/api/facultyinterestitems и не отображает страницу другого работающего основного проекта .net (Проект B), вместо этого отображается страница ошибки
Этот сайт не может быть достигнут. Соединение было сброшено.
Вот LaunchSettings.json для Проекта B
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://10.XX.XX.XX:53199",
"sslPort": 44378
} },
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/FacultyInterestItems",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"FacultyAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/FacultyInterestItems",
"applicationUrl": "http://10.XX.XX.XX:5050",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
} } }
и Program.cs изПроект B
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>().UseUrls("http://10.XX.X.XX:5050") ;
}
Пожалуйста, помогите