First, install Install .Net Core
Afterwards, Install Nginx
sudo apt install nginx -y
cat > /tmp/dotnet << EOF server { listen 80; 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; } } EOF sudo mv /tmp/dotnet /etc/nginx/sites-available/ sudo ln -s /etc/nginx/sites-available/dotnet /etc/nginx/sites-enabled/dotnet
Now, set up the .Net application as a service:
sudo mkdir -p /var/www/dotnet cat > /tmp/dotnet.service << EOF [Unit] Description=DotNet Application [Service] WorkingDirectory=/var/www/dotnet ExecStart=/usr/bin/dotnet /var/www/dotnet/dotnet.dll Restart=always RestartSec=10 SyslogIdentifier=dotnet-dotnet User=www-data Environment=ASPNETCORE_ENVIRONMENT=Development Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false [Install] WantedBy=multi-user.target EOF sudo mv /tmp/dotnet.services /etc/systemd/system/ systemctl enable dotnet.service