Try to deploy the Asp.net Core application on Linux,

Source: Internet
Author: User
Tags dotnet

Try to deploy the Asp.net Core application on Linux,

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.