Deploy an asp.net core API on a Linux server with nginx

Marnelle M'BENGUET 20 Reputation points
2023-09-21T11:42:05.2133333+00:00

hi I followed your tutorial on deploying an asp.net core API and I followed the same logic to deploy my API on an ubuntu server with Nginx, it happens that locally I access the API from the development environment, and even from another machine on the network I access via the IP address but when I deploy it on the linux server I get the error "This site is inaccessible" ip_adress n 'does not allow the connection, I have already opened all these ports with the ufw, I also added custom links in the launchSettings.json file, I added CORS but I cannot access anyone have any idea where the problem is coming from?

Thanks for your help

Developer technologies .NET Entity Framework Core
Developer technologies ASP.NET ASP.NET Core
Microsoft Security Intune Microsoft Intune Linux
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-09-22T15:38:28.5933333+00:00

    first check that launcher started the asp.net core app and it is using the desired port. this port (say 5000) is typically blocked so you will need to test on the linux server itself. if you have to remote, use curl. be sure to add forward headers if you app uses them. have an anonymous test page if the app requires authentication.

    now config and run Nginx.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.