1024programmer Asp.Net The most complete solution for deploying .NET Core to Linux (CentOS), advanced version (Docker+Nginx or Jexus)

The most complete solution for deploying .NET Core to Linux (CentOS), advanced version (Docker+Nginx or Jexus)

The most comprehensive solution for deploying .NET Core to Linux (CentOS), advanced version (Docker+Nginx or Jexus)

In the first two articles:

The most comprehensive solution for deploying .NET Core to Linux (CentOS), regular articles

The most complete solution for deploying .NET Core to Linux (CentOS), advanced (Supervisor+Nginx)

We have a full understanding of deploying .net core to Linux and can already meet the application requirements. In this article, we will continue to take you in-depth to learn about using Doker+jexus or Nginx to deploy .net core applications.

In the first two articles:

The most complete solution for deploying .NET Core to Linux (CentOS), regular articles

The most complete solution for deploying .NET Core to Linux (CentOS), advanced (Supervisor+Nginx)

We have a full understanding of deploying .net core to linux and can already meet the application requirements. In this article, we will continue to take you to learn more about using Doker+jexus or Nginx to deploy .net core applications.

Jexus is a high-performance WEB server and load balancing gateway server on the Linux platform. It features support for ASP.NET, ASP.NET CORE, and PHP. It also has important functions such as reverse proxy and intrusion detection. It can be said that Jexus is the best cross-platform host server for .NET and .NET CORE. If we think of it as IIS for the Linux platform, this is not an exaggeration, because Jexus is not only very fast, but also has IIS and other Web servers. A high degree of security that the server does not have. At the same time, Jexus Web Server is a domestic software completely independently developed by the Chinese. It is truly “safe, reliable and controllable” and has the key qualities required for the informatization construction of my country’s party and government agencies and important enterprises and institutions.

jexus official website: https://www.jexus.org/

The installation of jexus is very simple, execute the following command:

  1. curl https://jexus.org/release/x64/install.sh|sudo sh

Jexus installation

Note: Running the installation command requires the operator to have root privileges.

After the installation is complete, switch to the /usr/jexus directory and modify the default in the /usr/jexus/siteconf directory. The content is as follows:

Note: Because nginx was used in the previous chapter and port 80 was used, I use port 8099 here.

  1. port=8099 #port
  2. hosts=* #domain name span>
  3. AppHost={cmd=dotnet Core50Test.dll; root =/root/app_data/core50test/publish; port=5000}

Jexus configuration

Next, we restart jexus and execute the following command:

  1. /usr/jexus/jws restart

Restart jexus

After the Ok prompt, our application is started.

You can view the execution results by executing the following command:

  1. ps -aux

ps

You can see that our application has been started. Go to the browser and use port 8099 to browse and see the effect.

Browse Application

For more detailed instructions on using jexus, please refer to the official documentan>(uuidgen |sed ‘s/-//g’)

  • docker build -f Dockerfile -t core50test:${imtag } .
  • docker stop core50test
  • docker rm core50test
  • docker run -dit --restart=always --name core50test - span>p 81:80 core50test:${imtag}
  • docker one-click update application shell script

    Set execution permissions for the dockerbuild.sh file. The command is as follows:

    1. chmod 777 dockerbuild.sh

    When new code is pushed to the git repository, enter the server and execute dockerbuild.sh to quickly update the application.

    ./dockerbuild.sh

    Execute dockerbuild.sh to quickly update the application

    image-20210118175843088

    At this point, the introduction to deploying .net core using docker is completed.

    Docker commonly used commands are generally divided into the following categories:

    • Docker environment information — docker [info|version]
    • Container life cycle management — docker [create|exec|run|start|stop|restart|kill|rm|pause|unpause]
    • Container operation and maintenance — docker [ps|inspect|top|attach|wait|export|port|rename|stat]
    • Container rootfs command — docker [commit|cp|diff]
    • Mirror warehouse — docker [login|pull|push|search]
    • Local image management — docker [build|images|rmi|tag|save|import|load]
    • Container resource management — docker [volume|network]
    • System log information — docker [events|history|logs]

    Starting from the use of docker commands, the following command structure diagram is sorted out:

    docker common commands

    To view more detailed commands, you can view the official website or command help

    1. docker --help

    Through the introduction of the previous three articles, we have a very comprehensive understanding of the multi-scheme deployment of .net core to Linux, which is sufficient for small teams. Attentive students will notice that although the current solution can implement one-click deployment updates, you still need to log in to the Linux server to execute the corresponding commands.

    It shows that this is not the optimal solution, so is there a better solution? For example: after we submit it to the git warehouse, wouldn’t it be more convenient to automatically launch the deployment command?

    The answer is yes, we can achieve it with the help of Jenkins. If you are interested, you can research it yourself, or stay tuned for the explanation later. As well as devops implemented based on k8s in large projects. In fact, the principle of k8s implementing devops is similar to the above introduction. It is based on using gitlab’s runner or jenkins to monitor the status of the git warehouse. When the specified branch is found to have changed, the image is packaged, and then the image of the deployment of k8s is automatically replaced. renew. At the same time, k8s implements functions such as elastic scaling and rolling update.

    Author|Guosi Software

    This article comes from the blog garden, author: Gudao Qingfeng, please indicate the original link when reprinting: https://www.cnblogs.com/88223100/p/The-most-comprehensive-solution-for-deploying-NET-Core -to-Linux-CentOS-Docker_Nginx__Jexus.html

    n-for-deploying-NET-Core-to-Linux-CentOS-Docker_Nginx__Jexus.html

    This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/the-most-complete-solution-for-deploying-net-core-to-linux-centos-advanced-version-dockernginx-or-jexus-2/

    author: admin

    Previous article
    Next article

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Contact Us

    Contact us

    181-3619-1160

    Online consultation: QQ交谈

    E-mail: [email protected]

    Working hours: Monday to Friday, 9:00-17:30, holidays off

    Follow wechat
    Scan wechat and follow us

    Scan wechat and follow us

    Follow Weibo
    Back to top
    首页
    微信
    电话
    搜索