There is a point to this story, but it has temporarily escaped my mind...
Contact Me MyFaceBook MyLinkedIn MyGitHub MyTwitter

.Net Core ASP.Net

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
Copyright © 2022 by Julian Easterling. SOME RIGHTS RESERVED.
Privacy Policy              Terms of Use             


Creative Commons License
Except where otherwise noted, content on this site is
licensed under a Creative Common Attribution-Share Alike 4.0 International License.


All of the opinions expressed on this website are those of Julian Easterling and
do not represent the views of any of my current and previous clients or employers in any way.

If you notice an error on the site or content that has not been properly attributed, bring
it to my attention using the contact page and I will endeavor to fix it as soon as I can.

I accept no responsibility or liability for any damages incurred by following any of
my advice or by using any of the information on my site or of those sites that I link to.