Checklist for Hosting ASP.NET Core Site in Linux VM

Tags: dotnet, linux, ubuntu
Published: 2019-08-28 15:10:52

I have listed items with references which will help you in deploying your ASP.NET Core site from scratch in a fresh VM for a production environment.

* Install and Setup **Supervisor** - It is a tool which will help in the auto-start of your site on server restart, otherwise, on server restart, you might need to manually start site.
* Install and Setup **Nginx** - For Reverse Proxying to your .NET app
* Install DotNet Core
 https://dotnet.microsoft.com/download/linux-package-manager/ubuntu16-04/sdk-current
* Get a **domain** - Can get from GoDaddy or any other vendor.
* Setup and Install **Lets Encrypt** - To Obtain Free SSL Certification or if you have own certificate purchased you can also use it.
* **Enable Firewall** to allow port 80, 443 - or any other port based on your requirement.
* Enable **https redirect** in your Ngnix Configuration
* After Hosting ensure you have enabled basic **Security Headers** for the site - Can test Using Security Headers site- https://securityheaders.com/
* Can test your site for **SEO** if your site needs it - https://sharetechlinks.com/post/detail/101/free-seo-checker

**References**
* **Server Setup**
You can get a cheap Digital Ocean Server for $5–$10 which is more than enough to run a simple site. 
This site runs on same - https://sharetechlinks.com

* **Enabling Remote Desktop - XRDP**
https://websiteforstudents.com/connect-to-ubuntu-16-04-17-10-18-04-desktop-via-remote-desktop-connection-rdp-with-xrdp/

* **Installing Ubuntu Mate OS**
Usually, when you purchase Linux VM from Digital Ocean or any other Vendor you won't get OS. To install a lightweight Ubuntu Mate Linux OS

https://jerrygamblin.com/2016/10/19/ubuntu-remote-desktop-on-digital-ocean/

* **Supervisor, Nginx Configuration**
 https://www.hanselman.com/blog/PublishingAnASPNETCoreWebsiteToACheapLinuxVMHost.aspx

* **Microsoft Official Docs**
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.1&tabs=aspnetcore2x

* **Nginx - In-Depth configurations**
https://sharetechlinks.com/post/detail/173/nginx-everything-about-proxy-pass
https://sharetechlinks.com/post/detail/204/nginx-with-modsecurity-and-brotli-production-setup-dockerized

* **Setting up Firewall**
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-14-04

* **Installing Putty in Windows**

https://medium.com/@bharatdwarkani/5-easy-steps-to-install-putty-and-connecting-to-linux-ubuntu-server-in-windows-adcdc9d755dc

* **Transferring file from windows to Linux using Putty**
https://medium.com/@bharatdwarkani/copying-a-file-from-windows-to-linux-through-ssh-17f4f4c2eca8

* **Security Headers**
https://sharetechlinks.com/post/detail/133/adding-http-headers-to-improve-security-in-an-asp-net-core-application

* **Refer this for Unzip file in Ubuntu**
https://www.hostingadvice.com/how-to/unzip-file-linuxubuntu/

* **Installing My SQL In Linux**
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04

https://www.digitalocean.com/community/tutorials/how-to-secure-mysql-and-mariadb-databases-in-a-linux-vps

https://www.configserverfirewall.com/ubuntu-linux/enable-mysql-remote-access-ubuntu/

**Conclusion**
The above-mentioned checklist is more than enough to host your ASP.NET Core site in a fresh Linux VM starting from Scratch.