C#C
C#4y ago
oe

❔ Why can't I host my ASP.NET WebAPI on Ubuntu ?

1) I made a new user sudo adduser aspsites
2) I created a folder called surf and cloned my repo inside it git clone myurl
(now the full path is: /home/aspsites/surf/SurfFinder/SurfFinderAPI/SurfFinderAPI.csproj)
3) Ran
dotnet build
(all good)
4) Added the following configuration file in /etc/nginx/sites-enabled/aspsites:

server {    
    listen 80;

    server_name www.mywebsite.com;

    #root /var/www/html; # Replace with your application's root directory
    root /home/aspsites;

    location /surf/SurfFinder {        
        proxy_pass http://localhost:5000; # Replace with the port where your ASP.NET API is running             on                     
        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;    
    } 
}


5) Ran
dotnet run
and then the CLI got stuck? Now I can't run any command.

And of course, when I visit www.mywebsite.com/surf/SurfFinder/WeatherForecast nothing happens 🤔.

I'm sure I'm doing a bunch of things wrong. I am completely new to Linux & ASP.NET, but I'm willing to learn, so please help me if you can.
image.png
Was this page helpful?