Use details based on jexus-5.6.3

Time:2020-2-6

1、 Jexus web server configuration

In the working folder of jexus (usually “/ usr / jexus”), there is a basic configuration file named “JWs. Conf”.

There are at least two lines of information in jws.conf: siteconfigdir and sitelogdir:

Siteconfigdir = siteconf ා it means that the website configuration files are stored in the siteconf folder, and the relative path based on jws.exe file can be used

Sitelogdir = log ා means that the jexus log file is placed in the log folder, and the relative path based on jws.exe file can be used

Important:

Two dedicated folders must be specified and created for jexus: the log folder for log files and the site configuration folder for site profiles.

The log folder must allow the jexus system write right, because it will write important contents such as jexus system log and website access log here. A folder named log has been created in the installation program.

The site configuration folder is the place where the site configuration files are stored (the folder has been built in the installation package, and the name is siteconf). Even if there is only one site, there must be this folder, because the content of the site configuration will be read from this folder when jexus starts.

That is, by default, the folder structure of jexus is:

/Usr / jexus ා JWs working directory
/Usr / jexus / siteconf – website configuration directory
/Usr / jexus / log ා log directory

2、 Website configuration

Jexus supports multiple sites. You can set as many sites with different ports, domain names, and virtual paths.

All website configuration files must be placed in the website configuration folder specified by jws.conf (this folder is often the “siteconf” folder in the JWs working directory). This folder can not have any other files except website configuration files, because jexus will think that any file here represents a different website.

Each website has and only has one configuration file. The file name of the configuration file is the name of this website. For example, www.mysite.cn, the name of the configuration file can be written as “MySite” or other file names, so that the administrator can easily remember and recognize it, but special attention should be paid: the file name cannot have spaces!

A website can have as many domain names as possible. Different websites cannot have the same domain name. There can only be one website without domain name. This website without domain name is called “default website”, and a server can only have one default website at most.

***Once again:

1. The file name of the site configuration file cannot have spaces;
2. There can only be site profiles in the site configuration folder, and no other files can exist.

Take www.mysite.cn as an example to talk about the configuration of the website

Create a file in the website configuration folder. The name of the file should have some meaning (at least let the server administrator know which website the profile belongs to)

Set the file name of this website’s profile as: MySite

sudo vim mysite

A. Basic content of website configuration:

Port = 80 ා jexus web server listening port (required). Other ports, of course)
Root = / / var / www / MySite ා website URL root path (virtual directory) and corresponding physical path. The two path strings must be separated by spaces (required). Even if this website is a pure reverse proxy station, it has to be filled in)

Optional options
Hosts = mysite.cn, www.mysite.cn ා website domain name (recommended to be filled in), you can use pan domain name, such as *. Mysite.cn (do not fill in this item or just fill in a “*” sign to indicate that this is the default website, a port can only have one default station)
Indexes = index.aspx, index.htm ා the file name of the home page can be multiple, separated by English commas (it can be left blank). Because JWs system contains common homepage name)
Addr = 0.0.0.0 񖓿 bind to an IP address of the server’s local machine. By default, all addresses are “0.0.0.0”.
Aspnet? Exts = mspx, TTT? Add new or customized asp.net extension (not recommended). Multiple extensions are separated by English commas without dot. System contains common extensions)

B. Simplest configuration example

The simplest configuration requires only port and root, such as:

port=80
root=/ /var/www/default

Note: the meaning of the above two items: “port = 80” means that the service port of this website is 80 (standard web service port); “root = / / var / www / default” means that the virtual root path of this website is “/”, and the absolute path of the corresponding physical folder is “/ var / www / default”, that is, the content of the website must be placed in the folder “/ var / www / default”.

C. Advanced options for website configuration (read suggestions: it is recommended for beginners to skip this section)

The advanced options of website configuration are all optional, which should be selected according to the actual needs of the website.

With the flexible use of advanced options, you can build a unique and powerful server platform or server group.

1. Using the URL Rewrite feature

URL rewriting refers to that web server interprets and matches the request URL path resource of visitors as another real rul path resource according to the specified matching rules.

For example, when you want someone to access a file of type “. PHP”, the server returns the file / 404.html:

rewrite=^/.+?\.(asp|php|cgi)$ /404.html
Format:
#”Rewrite=” is followed by two parts, separated by a space between the two parts.

Before the space is the matching condition: use regular expression to describe the matching condition of URL.

After the space is the matching target: it refers to which rule the server will respond to if the path accessed by the user meets the previous matching criteria.

Another example is:

Resolve “/ BBS” to “/ BBS / index. ASPX”, and match “/ BBS / file-1” to “/ BBS / show. ASPX? Id = 1”:

rewrite=^/bbs$ /bbs/index.aspx
rewrite=^/bbs/file-([0-9]{1,6})$ /bbs/show.aspx?id=$1

Format explanation: Rewrite contains two parts after the equal sign, separated by space. The first half is a regular expression to describe the URL path style that needs to be rewritten (in the user’s browser). The second half is the real URL path that JWs should rewrite and access when the user’s URL conforms to the previous regular expression.

2. Prohibit or allow an IP or IP segment to visit the website

A. Only some IP addresses are allowed to visit the website (white list function)

By default, all IP addresses are allowed to access. If you manually set the IP address white list, the IP addresses outside the white list will be automatically blacklisted.

The configuration format is as follows:
allowfrom=1.2.3.*
AllowFrom=2.2.3.3

B. Forbid an IP or an IP terminal to visit the website (blacklist function)

By default, this configuration is empty. If you manually add IP addresses (segments) that need to be forbidden, you must follow one rule: the blacklist must be the true subset of the whitelist.
The configuration format is as follows:
denyfrom=111.222.111.*
denyfrom=101.201.1.132

3. Prohibit access to the contents of a folder and its subfolders

Denydirs = URL path of website folder path, such as “/ abcfiles” or “~ / abcfiles”, multiple paths, separated by English commas

4. Whether to perform security detection on the requested URL, etc

This option is true by default, that is, it needs to be checked. Unless you really need to turn off this option, you can leave it blank. The format is as follows:

checkquery=false

(turning it off can improve the server speed, but it is not recommended to turn it off for security)

5. Nofile function

nofile=/mvc/controller.aspx

(Note: This is a unique function of jexus, which refers to the file response that the server will use if there is no file to be accessed by the user.)

(Note: after routing, the original URL path will be stored in a server variable “x-real-uri” unique to jexus)

(tip: with this function, or with the URL Rewrite function, you can completely separate the URL path from the real path, so as to hide information and simplify the URL.)

6. Nolog function

nolog=yes

(Note: disabling the website log function will improve the processing speed of the web server system, but the deficiency is also obvious, that is, you can’t understand the website access in detail.)

7. Long connection switch

keep_alive=true

Note: the default value of v5.6.3 is true, that is, long connection is used by default, which can be left blank.

8. Reverse proxy function

reproxy= /abc/ http://www.xxxx.com:890/abc/

The value of the parameter consists of the local URL root path and the target site URL root path, separated by a space.

*Tip: there can be multiple target addresses for reverse generation, separated by commas, such as:

reproxy=/abc/ http://192.168.0.3/abc/,http://192.168.0.4/abc/

At this time, when the user accesses / ABC /, jexus will randomly select a server to access to achieve the effect of load balancing or server clustering.

9. Accept the services provided by fast-cgi

For TCP connections:

Fast CGI. Add = file extension requiring fast CGI processing | TCP: IP address of fast CGI service: Port

For example: fastcgi. Add = PHP, php3| TCP: 127.0.0.1:9000

For UNIX sockets:

Fastcgi. Add = file extension | socket: path requiring fcgi processing

For example: fastcgi. Add = PHP, php3| socket: / TMP / phpsvr

10. Enable gzip compression

Usegzip = true, that is usegzip

Explanation: with this feature enabled, when users access files such as “. HTM” “. JS”, jexus will gzip these files and send them to the user’s browser, which can save more network bandwidth.

11. Let the working process and website of jexus work under the specified user authority (identity)

In jws.conf, add a sentence: httpd. User = a user name that already exists in the system, such as httpd. User = www data

12. Let the working process of jexus and asp.net website work in the specified asp.net version environment

In jws.conf, add a sentence: runtime = version number, such as: runtime = v4.0.30319

13. Enable “asp.net pre cache”, improve the response speed of asp.net application, and reduce server pressure

This is a unique feature of jexus. It’s very powerful and practical.

The method is: add “< response.addheader (” pagecache time “,” 60 “);% > to the ASPX page that needs to enable the web platform level cache, where” 60 “is the timeout, in seconds.

14. Enable HTTPS for SSL secure transport

This function is to encrypt the data between the server and the customer, so as to improve the confidentiality in the process of data transfer. For details, please visit www.linuxdot.net.

15. Enable multiprocess parallel service

In the default configuration, jexus works in the single process mode. The advantages of single process are simple configuration and memory saving, but its weaknesses are also obvious. For example, it is difficult to give full play to the performance advantages of multi CPU and multi-core, large concurrent tolerance, more disaster tolerance and weak processes.

Therefore, it is beneficial to improve processing speed, large concurrent capacity, service stability and fault tolerance to start multi process on multi CPU (core) servers.

Methods to start multiple working processes: modify the httpd.processes line in the jws.conf file, remove the ා, and fill in the number of processes to be started after it is equal to (no more than CPU cores + 1, at the same time, no more than 8 at most).

Stress: after multi process is enabled, session state service of asp.net website can no longer use InProc mode, but should use other modes such as “stateserver” and configure “machinekey” in web.config, otherwise session data loss will occur.

16. Limit the consumption of memory and CPU resources per worker process

This is the parameter that started to be enabled in version 5.5, which is set in jws.conf, and the format is.

Httpd. Maxtotalmemory = total amount of physical memory that can be consumed by all worker processes. The unit is megabyte, and the value range is 256 – the integer of the available physical memory size of the server. At the same time, on average, each working process cannot be less than 128M. 0 means that jexus automatically sets it according to the size of the physical memory.

Httpd. Maxcputime = total time that a single worker process can consume CPU resources. The unit is “second”, and the value range is an integer of 300-14400. 0 means this item is disabled

3、 Operate jexus

1. Basic operation:

The original commands such as jws.start have been merged into a single command in jexus v5.6.3, namely “JWs”, which is a shell script file.

Command parameters and corresponding functions:

JWs start: start jexus;
JWs start site name: start the specified site
JWs restart: restart jexus
JWs restart website name: restart the specified website
JWs stop: stop jexus
JWs stop site name: stop the specified site
JWs regsvr: global assembly required to register jexus (this command is only used after installing or updating jexus, and must be used once).
JWs status: whether jexus is running
Jws-v: display the version number of jexus

Note that these scripts should be owned by root and have executable rights.

2. Let jexus start automatically when the server starts:

Method: add the line “/ usr / jexus / JWs start” to the / etc / rc.local file. Note that the path should be the actual path of JWs in your system. Do not write the path wrong.

4、 Uninstall jexus

1. Delete the command line of jexus that you added manually in the rc.local file (this step is unnecessary if it has not been added originally)

2. Delete the jexus folder and all its contents (it is recommended to delete only *. Exe and *. DLL. Other files, such as website configuration files, do not need to be deleted so that they can be re enabled in the future).

The above detailed explanation based on jexus-5.6.3 is the whole content shared by the editor. I hope it can give you a reference, and I hope you can support developepaer more.

Recommended Today

Engineering of Vue front end (I) (master multiple communication and data synchronization of components)

Component communication Parent child component communication Parent child props property Child to parent $emit event There are very detailed descriptions in these two official documents, so they can’t be explainedOr a chestnut: //Parent.vue parent component <template> <div> parent: {{money}} <Son1 v-model=”money”></Son1> <!– <Son1 :value.sync = “money”></Son1> –> //Both of them can be written in syntax. […]