Home > Backend Development > C#.Net Tutorial > Detailed graphic and text explanation of Asp.net Core application deployment on Linux

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

黄舟
Release: 2017-09-25 11:13:46
Original
5541 people have browsed it

I haven’t touched .net for almost two months, but I use Linux every day, so I want to try running my favorite .net application on Linux.

  • Install CentOS

  • ##Install .Net core for Linux<span style="font-size: medium;"></span>

  • Create Asp.net Core application<span style="font-size: medium;"></span>

  • Install Nginx<span style="font-size: medium;"></span>

  • Configure Nginx proxy<span style="font-size: medium;"></span>

1,<span style="font-size: medium;"></span>Install CentOS system<span style="font-size: medium;"></span>

This online tutorial has too many filters. <span style="font-size: medium;"></span>

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

2. Install the cross-platform .NET Core SDK for CentOS7<span style="font-size: medium;"></span>

  • sudo yum update

  • sudo yum install libunwind libicu

  • sudo yum install dotnet-sdk-2.0.0

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

##dotnet --infocan confirm Is the installation successful

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

#3. Create an Asp.net Core application

<span style="font-size: medium;"></span>

dotnet new web

<span style="font-size: medium;"></span>

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

Due to the need for external access to the virtual machine, the default localhost settings must be modified:

<span style="font-size: medium;"></span>

vi Program.cs

<span style="font-size: medium;"></span>

Add UseUrls("http://*:5000")

<span style="font-size: medium;"></span>

Detailed graphic and text explanation of Asp.net Core application deployment on Linux## Publish and test

<span style="font-size: medium;"></span>dotnet publish –c release

<span style="font-size: medium;"></span>dotnet TestAspnetCore.dll

<span style="font-size: medium;"></span>

Detailed graphic and text explanation of Asp.net Core application deployment on LinuxKey points: Setting up the firewall

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --permanent --zone=public --add-port=5000/tcp
Copy after login
sudo firewall-cmd --reload
Copy after login
<span style="font-size: medium;"></span>

##Virtual machine external access confirmationDetailed graphic and text explanation of Asp.net Core application deployment on Linux

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

4, install Nginx

<span style="font-size: medium;"></span>sudo yum install epel-release

<span style="font-size: medium;"></span>sudo yum install nginx

<span style="font-size: medium;"></span>nginx –v View version

<span style="font-size: medium;"></span>

Find the IP address of Linux and start the Nginx serviceDetailed graphic and text explanation of Asp.net Core application deployment on Linux

<span style="font-size: medium;"></span>

##Virtual machine External access address

Detailed graphic and text explanation of Asp.net Core application deployment on Linux

Note: If this page cannot be displayed, it is likely that the firewall is not set. <span style="font-size: medium;"></span>

Detailed graphic and text explanation of Asp.net Core application deployment on Linux5, configure Nginx proxy

<span style="font-size: medium;"></span>

nginx detailed settings to be continued

The above is the detailed content of Detailed graphic and text explanation of Asp.net Core application deployment on Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template