Almost two months without contact with. NET, but every day with Linux, so want to try to run in Linux like. NET Applications.
- Installing CentOS
- Install. Net Core for Linux
- Creating an ASP. NET Core Application
- Installing Nginx
- Configure Nginx Proxy
1, Installing the CentOS system
This online tutorial has filtered too much.
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--info can confirm that the installation is successful
3. Create an ASP. NET Core Application
dotnet New Web
The default localhost setting is modified because external access to the virtual machine is required:
VI Program.cs
Add Useurls ("http://*:5000")
Publish and Test
dotnet Publish–c Release
Dotnet TestAspnetCore.dll
Focus: 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
Virtual Machine External Access acknowledgement
4, install Nginx
sudo yum install epel-release
sudo yum install nginx
nginx –v 查看版本
Find the IP address of Linux and start the Nginx service
Virtual Machine External Access address
Note: If this page cannot be displayed, it is estimated that the firewall is not set.
5, configure Nginx Proxy
Nginx detailed settings to be continued
Try to deploy an ASP. NET core application on Linux