The best VPN 2022

The Best VPS 2022

The Best C# Book

Jexus deployment mvc website guide

Jexus deployment mvc website guide, during this time I need to deploy the website developed using traditional mvc technology on the Centos 7 server, the original Centos 7 deployment of webform development of the website is not Supported, or you need to use mono.

Fortunately, now you only need to install Jexus on the Linux server to deploy the webform website or mvc website on the Linux server. By the way, you can now use core to develop websites, you don’t have to be so troublesome, because .net core itself supports cross-platform deployment, the website mentioned in this post was a company that used more than 10 years ago It is developed by webform, and the client needs it to run on a Linux server for some reason, and I chose Centos 7 as the server.

Before starting, you need to install the Centos server, because various management operations of the Centos server are performed using the command line (terminal), in order to manage the Centos server more conveniently, I installed aapanel, a visual Linux server management panel, It allows you to manage Linux servers in a very comprehensive way. The key point is that it is free and open source, and provides Chinese and English versions.

Install the aapael panel

aapael is a visual web panel for managing Linux servers. After installing the panel, server management can be done directly on the browser, such as website deployment, database installation, port opening or disabling, scheduled tasks, backup, file management, and more.

aapael official website: (Chinese)
aapael official website: (English)

When using it for the first time, log in to the Centos server (other servers are similar, such as Ubuntu, Debian, etc.) through a client such as putty using the root account, and then execute the following command to install:

Centos install script:

yum install -y wget && wget -O && sh

Ubuntu/Deepin installation script

wget -O && sudo bash

Debian installation script

wget -O && bash

Fedora installation script

wget -O && bash

Note: aapanel must be installed for a new system that has not installed other environments such as Apache/Nginx/php/MySQL, it is recommended to use centos 8.X systems

After aapanel is installed, in the last prompt text there is aapanel’s login entry address, user name, password and other information that needs to be recorded and copied and saved directly. User name and password can be modified in aapanel. If you forget the user name and password, please use SSH (such as putty) to log in to the server. Run the following commands to see the login address, user name, password and other information.

View aapanel login entry, user name, password command: /etc/init.d/bt default

Jexus deployment mvc website
Jexus deployment mvc website

Install Jexus

Just install the latest version of Jexus. It should be noted that when installing Jexus, you need to distinguish between the X86_64 system and the ARM64 system. Like some cloud servers, the ARM64 system may be used, so you need to pay attention. When installing Nexus, execute the following command:

X86_64 system

The command to install jexus standalone is:


Jexus deployment mvc website guide

ARM64 system

The command to install jexus standalone is:


Jexus deployment mvc website guide

Jexus deployment mvc website

The webform website and the mvc website cannot be deployed across platforms originally. The Jexus installed in the previous step has its own Linux mono runtime to support .net programs.

In this way, the website program developed by .net can be deployed to the Linux server, but it should be noted that Mono does not support the latest .net environment and needs to be downgraded, compiled and released.

After testing, especially for the reference class library of mvc, it should be noted that the latest version cannot be used. The specific reference class libraries and versions that can be used are as follows:

MVC class library reference version

  • System.Net.Http.Formatting-5.2.4
  • System.Web.Mvc-5.2.4
  • System.Web.Http—5.2.4
  • System.Web.WebPages.Razor-3.0.0

Other things to note

  • URL addresses (routing) and static resource addresses are strictly case-sensitive
  • Set of applications under virtual directory is not supported (described separately later)
  • The file path is based on Linux, Win path such as “D:\” is not supported

Update web.config

The system.web configuration node is updated to solve the problem of System.Net.Http.

<compilation debug="true" targetFramework="4.7.2">
        <add assembly="System.Net.Http, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

set of applications under virtual directory

On Windows servers, the deployment website can nest applications under virtual directories, as shown in the following figure:

Jexus deployment mvc website
Jexus deployment mvc website

The uploadserver in the figure above is nested into the virtual directory of service as an application. If you want to access the page in the uploadserver, the request address is:

When uploadserver is deployed to Jexus, if the link style of /service/uploadserver is still maintained, and the website is developed using mvc, there will be a problem that the root directory of the website cannot be correctly located and report to System .InvalidOperationException error. As shown below:

Jexus deployment mvc website

Solving this problem requires two aspects:

First: configure the website in the siteconf file of Jexus, do not configure the second-level or two-segment path. The following figure is the original configuration.

error conf
Jexus deployment mvc website

You only need to modify the configuration in the above figure to one level or one path. As shown below:
Jexus deployment mvc website

Second: Configure the reverse proxy, find the root file in the Jexus siteconf to modify, and add the node as shown in the figure below for reverse proxy.

The reproxy=/service/uploadserver on the left indicates that when the requested address matches, it is actually a reverse proxy request for the server This Address, if you will configure nginx reverse proxy, this is not difficult to understand.

Jexus deployment mvc website

Through the reverse proxy, the URL address before the migration can be kept the same, so there is no need to modify any code to keep the request interface or URL consistent.

Webform deployment tips

Recently, I finally completed the migration of the webform website. In addition to paying attention to the capitalization of all resources (URL capitalization), it is the bug repair and compatibility processing in the program.

Deploying the webform website to the centos system requires the help of the jexus server. In the actual operation process, I publish the website directly through FTP. The general steps are as follows:

First: Install Pure-Ftpd in the pagoda panel, that is, install the FTP service first.

Second: Create an FTP account and point the FTP directory to the website directory. It should be noted here that if your website uses a virtual directory in the original IIS deployment, or if it is deployed as a separate application under the main site, in Visual Studio When configuring FTP publishing, the FTP site path can be configured according to the path hierarchy. Below is the illustration:

image 5
Jexus deployment mvc website

For example, on IIS, a virtual directory rzjh (人在江湖) is built under the main site of, and then a mnjh (人在江湖) application is built under rzjh (美女江湖), and the corresponding access address is :

The Visual Studio publish configuration steps are as follows:

image 1
Jexus deployment mvc website
image 2
Jexus deployment mvc website

After the configuration is complete, click Configure, as shown in the figure below, to verify whether the FTP connection is successful.

image 3
Jexus deployment mvc website

Next, click the Settings tab, as shown below.

image 4
Jexus deployment mvc website

Through this configuration, you can directly publish the webform website to Centos through FTP in VS, saving the trouble of copying files through the client. For dozens of websites to be published and deployed to centos, this kind of This method is more convenient in the development stage. Of course, you may say that it is possible to use continuous integration tools to automatically release.

Sometimes when FTP publishing is configured, an FTP publishing error will appear when you click publish, and you will get the following tips.

Failed to add 'bin/' to website when FTP publish error. Ready to proceed (200)

The solution is: 1. Delete the release configuration and create a new one. 2. Check the FTP directory permissions, you can directly give 777 permissions, that is, both read and write permissions. You can directly set the corresponding directory permissions in the pagoda panel. Of course, you can also use the command: chmod -R 777 /www/, and directly set the permissions for the directory to fully open. Change to 777 to indicate that the user, other users in the user group, and other users can read, write and execute, which is a full permission.

image 6

Leave a Comment