Linux serverlinux web serverNETWORK ADMINISTRATIONS

How to deploy .Net core application into a Linux VM with Docker & Nginx

This is a step by step guide on how to deploy a .Net core application into a Linux VM using Docker and Nginx Web Server.

*********** Pre Requirements ***************
Install winscp: https://winscp.net/eng/download.php

Have a Linux VM created with docker and Nginx see video: https://www.youtube.com/watch?v=o7CJdYucKLY&t=16s

Application .Net Core: https://github.com/kainite/AZCoreApp

*********** Documentation ***************
Asp.net core on linux with Nginx:
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-3.1

*********** Scripts ************************
#Install Microsoft Dotnet SDK: 3.1

sudo apt-get update

sudo apt-get install nginx

wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update

sudo apt-get install dotnet-sdk-3.1

#Compile & Publish the application on the local machine run:
..AZCoreAppHSCoreAppbinDebugnetcoreapp3.1publish
dotnet publish

On the Server after copying:
Publishdotnet HSCoreApp.dll (case sensetive)
user/share/etc/nginx/sites-available/sudo chmod 677 default

*********** Default file config ***************
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
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;

#After update file reload Ngnix
sudo nginx -s reload

For Azure and Power Platform Services contact me: hugo.silva@execut3.com

***** Buy me a coffee *****
https://www.buymeacoffee.com/hugosilva

***** Affiliate Products *****
All products on this list I use and recommend since quality vs price are the best also I only recommend a product that I’m satisfied with it

Studio recording gear I use:
Camera: https://amzn.to/2R4pAER
Camera Exterior: https://amzn.to/2FcdpU8
Lights: https://amzn.to/2F36LiN
Full green screen kit: https://amzn.to/3i2OH6R
Microphone: https://amzn.to/3h29rKV

Desktop gear I use:
Keyboard: https://amzn.to/2QUnjw2
Mouse: https://amzn.to/35asDny
KVM switch: https://amzn.to/3jKo0nW
Laptop holder: https://amzn.to/2ZavqZS
Arm Rest: https://amzn.to/3320trT
Wifi USB: https://amzn.to/2F6jhy0
Desktop Fans: https://amzn.to/3gZTrZF
Power supply: https://amzn.to/2FdxhG4
Memory: https://amzn.to/2Z7IiAc
SSD: https://amzn.to/3lWGUd8
Motherboard: https://amzn.to/2QXeamn
Processor: https://amzn.to/3ig8XlX
GPU: https://amzn.to/3h0p8Co
Tower: https://amzn.to/3jO7iEd

source

by Hugo Silva | Finance & Code

linux web server

3 thoughts on “How to deploy .Net core application into a Linux VM with Docker & Nginx

Comments are closed.