Try to deploy the Asp.net Core application on Linux, asp. netcore
I haven't touched. net for nearly two months, but I am using Linux every day. So I want to try to run my favorite. net application on Linux.
- Install CentOS
- Install. Net core for Linux
- Create an Asp.net Core application
- Install Nginx
- Configure Nginx proxy
1. Install CentOS
This online tutorial is too much for filtering.
2. Install the cross-platform. NET Core SDK for CentOS7
- Sudo yum update
- Sudo yum install libunwind libicu
- Sudo yum install dotnet-sdk-2.0.0
Dotnet -- infoCheck whether the installation is successful.
3. Create an Asp.net Core application
Dotnet new web
You need to modify the default localhost settings for external access to the VM:
Vi Program. cs
Add UseUrls ("http: // *: 5000 ")
Release and Test
Dotnet publish-c release
Dotnet TestAspnetCore. dll
Key: setting up a firewall
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=httpssudo firewall-cmd --permanent --zone=public --add-port=5000/tcp
sudo firewall-cmd --reload
VM external access confirmation
4. Install Nginx
sudo yum install epel-release
sudo yum install nginx
View nginx-v version
Find the Linux IP address and start the Nginx Service
Virtual Machine external access address
Note: If the page cannot be displayed, it is estimated that the firewall is not set.
5. Configure the Nginx proxy
Nginx detailed settings to be continued