Welcome! Log In Create A New Profile

Advanced

.net 5.0 API and nignx on linux 18.04

Posted by mjancic 
.net 5.0 API and nignx on linux 18.04
February 08, 2021 04:09AM
Hi,

I must say I am using this forum as a last resource before putting everything aside and becoming yoga teacher.

These are the steps I executed, but don't seem to work as I keep getting the "This site can't be reached in my browser".

1. Created a .net 5.0 backend. It's API, runs locally on my windows 10 OS like charm. So, the next step is obvious -> deploy to server so others can see it.
2. Created a droplet on digital ocean. Went for the Ubuntu 18.04 because of the tutorial I was following (I guess that didn't work, did it?). Installed dotnet-sdk-5.0 and nginx.
3. Locally builded and created publishable files targeting linux-x64. uploaded them to /var/www/glista on the server.
4. Disabled firewall (ufw) on server, just because I didn't know what else to do.
5. At this point I am still able to see the Nginx Welcome page on the IP adress of the server.
6. Then I edited the /etc/nginx/sites-available/default to:
server {
listen 80;
server_name example.com *.example.com;
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;
}
}
7. Followed by editing the service /etc/systemd/system/glista.service
[Unit]
Description=Example .NET Web API App running on Ubuntu

[Service]
WorkingDirectory=/var/www/glista
ExecStart=/usr/bin/dotnet /var/www/glista/Glista.Api.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

8. Enabled, started the service and checked the status (it was running).

Nooooow.

It doesn't work. Going to my ip adress I get the 404. Going to my IP/swagger/index.html -> "Site can't be reached." It is killing me.

this is the ip: http://159.65.127.95
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready