Based on the use of Jexus-5.6.3 details, jexus-5.6.3 use Details

Source: Internet
Author: User

Based on the use of Jexus-5.6.3 details, jexus-5.6.3 use Details

1. Jexus Web Server Configuration

In the jexus working folder (usually "/usr/jexus"), there is a basic configuration file named "jws. conf ".

Jws. conf contains at least SiteConfigDir and SiteLogDir lines:

SiteConfigDir = siteconf folder indicates that the website configuration file is stored in the siteconffolder. You can use the relative path based on the jws.exe file.

SiteLogDir = log folder indicates that the jexuslog file is stored in the logfolder. You can use the relative path based on the jws.exe file.

Important:

You must specify and create two dedicated folders for Jexus: one for storing log files and the other for storing website configuration files ".

The log folder must give the jexus system the write permission, because it will write important content such as jexus system logs and Website access logs here. A folder named log has been created in the installer.

The website configuration folder is the place where the website configuration file is stored (this folder has been created in the installation package, and its name is siteconf). This folder must exist even if there is only one website, because jexus will read the website configuration content from this folder at startup.

That is, by default, the Jexus folder structure is:

/Usr/jexus # JWS working directory

/Usr/jexus/siteconf # website configuration directory

/Usr/jexus/log # log directory

Ii. Website Configuration

Jexus supports multiple sites. You can use different ports, domain names, and virtual paths to set any number of websites.

All website configuration files must be placed in jws. in the website configuration folder specified by conf (this folder is often the "siteconf" folder in the jws working directory), this folder cannot contain any other files except the website configuration file, because jexus will think that any file here represents a different website.

Each website has only one configuration file. The name of the configuration file is the name of the website. For example, for a website named www.mysite.cn, the configuration file name can be written as "mysite" or other file names, this makes it easy for administrators to remember and recognize files. Note that the file name cannot contain spaces!

A website can have any number of domain names. different websites cannot have the same domain name. A website without a domain name can only have one domain name. This website without a domain name is called "default website ", one server can only have one default website.

*** Re-emphasize:

1. The website configuration file name cannot contain spaces;

2. The website configuration folder can only contain website configuration files, but cannot contain other files.

The following uses www.mysite.cn as an example to describe the website configuration.

Create a file in the website configuration folder. The file name should be meaningful (at least let the server administrator know which website the configuration file belongs)

Set the name of the configuration file for this website to mysite.

Sudo vim mysite

A. Basic website configuration content:

Port = 80 # jexus WEB server listening port (required. Of course it can be another port)

Root = // var/www/mysite # The root path (virtual directory) of the website URL and the corresponding physical path. the strings of the two paths must be separated by spaces (required. This website is a pure reverse proxy site)

# Optional

Hosts = mysite.cn, www.mysite.cn # website domain name (recommended). You can use a wildcard domain name, for example, * .mysite.cn (if this is not entered, or if only one "*" is entered, This is the default website, one port can only have one default site)

Indexs?index.aspx,index.htm # Name of the homepage file. Multiple names can be written and separated by commas. Because the JWS system contains common homepage names)

Addr = 0.0.0.0 # bind an IP address to the local server. By default, all IP addresses are called "0.0.0.0 ".

Aspnet_exts = mspx, ttt # Add new or custom ASP. NET extensions (not recommended. Multiple extensions are separated by commas (,) without adding numbers. The system contains common extensions)

B. Simplest configuration example

The simplest configuration is port and root, for example:

Port = 80

Root = // var/www/default

Note: "port = 80" indicates that the Service port of the website is 80 (standard WEB Service port ); "root = // var/www/default" indicates that the virtual root path of the website is "/", the absolute path of the corresponding physical folder is "/var/www/default", that is, the website content must be placed in the "/var/www/default" folder.

C. Advanced options for website configuration (read suggestion: Skip this section for beginners)

The advanced options for website configuration are all optional and should be selected based on the actual needs of the website.

Flexible use of advanced options allows you to build a distinctive and powerful server platform or server group.

1. Use the URL rewriting Function

URL rewriting means that the WEB server interprets and matches a visitor's request URL path resource as another real RUL path resource according to the specified matching rules.

For example, if you want someone to access a file of the ". php" type, the server returns the file/404.html:

Rewrite = ^/. +? \. (Asp | php | cgi) $/404.html

# Format:

# "Rewrite =" is followed by two blocks, separated by a space.

Match conditions before spaces: use regular expressions to describe URL matching conditions.

Matching target after space: indicates the rule in which the server will respond if the user's access path meets the preceding matching conditions.

Another example:

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 description: The equal sign of rewrite contains two parts, separated by null. The first half is a regular expression used to describe the URL path style that requires url rewriting (in the user's browser). The second half is when the user's URL conforms to the regular expression, JWS should rewrite and access the real URL path.

2. prohibit or allow access to a website from an IP address or IP address segment

A. Only some IP addresses are allowed to access the website (whitelist function)

By default, access from all IP addresses is allowed. If you manually set an IP address whitelist, IP addresses outside the whitelist are automatically blacklisted.

Configuration format, such:

Allowfrom = 1.2.3 .*

AllowFrom = 2.2.3.3

B. prohibit an IP address or an IP address from accessing the website (blacklist function)

By default, this configuration is empty. If you manually add IP addresses (segments) that require access prohibition, the blacklist must be a real subset of the whitelist.

Configuration format, such:

Denyfrom = 111.222.111 .*

Denyfrom = 101.201.1.132

3. Prohibit Access to contents in a folder and Its subfolders

DenyDirs = the URL path of the website folder, such as "/abcfiles" or "~ /Abcfiles ", multiple paths separated by commas

4. Whether to perform security detection on the requested URL or not

This option is true by default, that is, check is required. You can leave this option empty unless you do need to disable it. The format is as follows:

Checkquery = false

(Disabling this item can increase the server speed, but it is not recommended for security)

5. NOFILE (no file) Function

Nofile =/mvc/controller. aspx

(Note: This is a Jexus-specific function. It refers to the file to be accessed by the server if it does not exist .)

(Note: After routing, the original URL path will be stored in "X-Real-Uri", a server variable dedicated to Jexus)

(Tip: with this function or the URL Rewrite function, you can completely isolate the URL path from the actual path to hide information and simplify the URL .)

6. NOLOG (no log) Function

Nolog = yes

(Note: disabling the website log function will increase the processing speed of the WEB server system, but the insufficiency is obvious, that is, you cannot know the Website access details)

7. persistent connection Switch

Keep_alive = true

Note: The default value of V5.6.3 is true, that is, persistent connections are used by default, which can be left blank.

8. Reverse Proxy

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

The parameter value consists of the URL root path of the site and the URL root path of the target site.

* Tips: there can be multiple reverse generation target addresses separated by commas (,), for example:

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

In this case, when a user accesses/abc/, jexus randomly selects a server for access to achieve load balancing or server cluster performance.

9. Accept the services provided by FAST-CGI

For TCP connections:

Fastcgi. add = file extension that requires fast-cgi processing | tcp: IP address of the fast-cgi service: Port

For example: fastcgi. add = php, php3 | tcp: 127.0.0.1: 9000

For unix sockets:

Fastcgi. add = file extension for fcgi processing | socket: Path

For example: fastcgi. add = php, php3 | socket:/tmp/phpsvr

10. Enable the gzip compression function

Usegzip = true # UseGzip

Explanation: after this function is enabled, Jexus will compress these files by GZIP and then send them to the user's browser when the user calls ".htm ". js" and other files, thus saving more network bandwidth.

11. Let Jexus's work process and website work under the specified user permission (identity)

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

12. Let the Jexus working process and ASP. NET Website work in the specified ASP. NET version environment.

In jws. conf, add Runtime = version number, for example, Runtime = v4.0.30319.

13. Enable "ASP. NET pre-high-speed cache" to speed up the response of ASP. NET Applications on websites and reduce server pressure

This is a unique feature of Jexus. Powerful and practical.

Add "<% Response. addHeader ("PageCache-Time", "60"); %> "indicates the timeout Time, in seconds.

14. Enable HTTPS for SSL Secure Transmission

This function is used to encrypt the data transmitted between the server and the customer, improving the confidentiality during the data transfer process. For details, visit www.linuxdot.net.

15. Enable multi-process parallel service

By default, jexus works in a single process mode. The advantage of a single process is that the configuration is simple and memory saving, but the weakness is also obvious. For example, it is difficult to give full play to the performance advantages of multiple CPUs and multiple cores, as well as high concurrency and low disaster tolerance.

Therefore, enabling multi-process on a multi-CPU (CORE) server is conducive to improving processing speed, high concurrency carrying capacity, and service stability and fault tolerance.

How to enable multiple working processes: Modify jws. httpd. in the processes line, remove the # sign in the front and fill in the number of processes to be enabled after the value is equal to (no more than the number of cpu cores + 1, at the same time, no more than 8 processes ).

Note: After multi-process is enabled, ASP. the Session Status Service of the NET website can no longer use the inproc mode, but should use other modes such as "StateServer" and in the Web. configure "machineKey" in config; otherwise, Session data may be lost.

16. restrict the consumption of memory and cpu resources by each worker process

This is the parameter that is enabled in version 5.5. It is set in jws. conf. The format is.

Httpd. MaxTotalMemory = total physical memory that can be consumed by all worker processes. The Unit is mb. The value range is 256-an integer indicating the size of the physical memory available on the server. At the same time, the average value of each worker process cannot be less than 128 MB, 0 indicates that jexus is automatically set based on the physical memory size.

Httpd. MaxCpuTime = the total time that a single worker process can consume Cpu resources. The Unit is second. The value range is an integer between and. 0 indicates that this item is disabled.

3. Operate Jexus

1. Basic operations:

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 website name: start the specified website

Jws restart: restart Jexus

Jws restart website name: restart the specified website

Jws stop: stop Jexus

Jws stop website name: stop the specified website

Jws regsvr: registers the global assembly required by jexus (this command is only used after jexus is installed or updated, and must be used once ).

Jws status: whether Jexus is running

Jws-v: displays the Jexus version number.

Note that the owner of these scripts should be root and have executable permissions.

2. Enable Jexus to automatically start with server startup:

Add "/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 manually added command line for automatically starting Jexus at startup in the rc. local file (if it has not been added, this step does not need to be done)

2. Delete the jexus folder and all the content (we recommend that you only delete *. exe and *. dll. For other files, such as website configuration files, you do not need to delete them so that they can be re-enabled in the future ).

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.