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

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
719 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,345 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,574 questions
Microsoft Intune Linux
Microsoft Intune Linux
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Linux: A family of open-source Unix-like operating systems.
46 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,376 Reputation points
    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