Deployment of Asp.Net project to Linux (Linux + Jexus+Nginx)

Because the Asp.Net Web API technology used in the old project was developed and deployed on the Window system, and the new project was deployed on the Ubuntu system using .Net Core, it was somewhat inconvenient to manage the switch. So I decided to deploy the test server of the old project to Ubuntu to try the water.

1. Brief introduction

  To implement the deployment of Asp.Net projects to Linux, Mono must be used. Mono is equivalent to the .Net Framework in Window and the .Net runtime in Linux. It can run not only in Linux but also in Window.

  Jexus is a high-performance WEB server based on .NET compatible environment, running on Linux/unix operating system, and supporting ASP.NET as the core function. To put it bluntly, it is equivalent to IIS in Windows. There are two versions of Jexus: Professional Edition and General Edition. The Jexus professional version comes with Mono, and the Jexus version can run normally without installing mono on the client server. This version only supports 64-bit Linux operating system. The general version of Jexus does not include Mono, so users should first install mono and libgdiplus on the client machine. In order to avoid unnecessary trouble, I choose the professional version for deployment.

2. Installation

  2.1. Download:  

  Address: http://www.linuxdot.net/down/jexus-5.1.tar.gz

  2.2. Decompression:
  tar -zxvf jexus-5.1.tar.gz

  2.3. Installation:
  After decompression, it can be used directly. When uninstalling, just delete this folder directly, completely green version.

  2.4. Commonly used commands

  Start: sudo ./jws start

  Restart: sudo ./jws restart

  Stop: sudo ./jws stop

  2.5. Test

  First create the /var/www/default folder (this folder is the specified default website path), create an Index.aspx in the folder, write

 
 
  1. <%@Page Language="C#"%>
  2. <%=DateTime.Now.ToString()%>

Switch to the jexus directory, start jexus, and request the Index page. Because only port 80 is open to the outside world in this Linux system, and port 80 has been occupied by other projects. So you need to configure the port in the default file to be 8020 in the siteconf folder of jexus. If you have not deployed other websites on your machine, you don't need to configure the port, just culr localhost. If the time is successfully printed out, the configuration is successful.

Three, jexus configuration

  The configuration file of jexus is jws.conf, which specifies the storage location, log, certificate, etc. of the website configuration file. The following is the details

    SiteLogDir=log #Storage location of website logs and Jexus system logs, required. You can use the relative path based on the jws.exe file.
    SiteConfigDir=siteconf #The location where the website configuration file is stored is a required item. You can use an absolute path or a relative path based on the jws.conf file
    Runtime=v4.0.30319 #Set which .NET version the Jexus work process runs on
    httpd.processes=1 #The number of work processes, it is recommended that each 6-8 core The CPU uses one process, and up to 4 processes can be set
    httpd.user=www-data #What user identity and corresponding authority should the working process work with, the default is root
    php-fcgi.set=/usr/bin/php-cgi,6 # If you need Jexus to act as the PHP FastCGI server at the same time, this sentence is the fast-cgi setting, which is divided into two parts. Before the comma is the path of the php-cgi file, and after the comma is the number of php processes. CertificateFile=/xxxx/xx.crt #SSL
    certificate Path (fill in if you need to use the https protocol)
    CertificateKeyFile=/xxxx/xx.key #SSL key file path (fill in if you need to use the https protocol)

  Note: In jws.conf, SiteConfigDir and SiteLogDir are required items.

   In the website configuration file, this folder has a default file by default, the default port is 80, and the default website resource path is /var/www/default. The above test example is the simplest configuration used.

  When configuring, you must first pay attention to the following three rules:
  1) All website configuration files must be placed in the website configuration folder specified by jws.conf. This folder cannot contain any other files except website configuration files, because jexus will think that Any file here represents a different website.
  2) Each website has one and only one configuration file, and the file name of the configuration file is the name of the website, such as www.mysite.cn, the configuration file name can be written as "mysite", of course, it can also be written as other file names, so that Administrators are easy to remember and recognize, but pay special attention: the file name cannot have spaces!
  3) A website can have any number of domain names. Different websites cannot have the same domain name. There can only be one website without a domain name. This website without a domain name is called a "default website", and a server can only have one default website at most .

 

Guess you like

Origin blog.csdn.net/xsq123/article/details/128690558