Jexus-5.6.3 using a detailed, Jexus WEB server configuration

Source: Internet
Author: User

One, Jexus Web server configuration

In Jexus's working folder (typically "/usr/jexus") there is a basic configuration file with the file name "jws.conf".

There are at least two lines of information in jws.conf Siteconfigdir and Sitelogdir:
Siteconfigdir=siteconf #指的是存放网站配置文件放在siteconf这个文件夹中, you can use a relative path based on the Jws.exe file
Sitelogdir=log #指的是jexus日志文件放在log这个文件夹中, you can use a relative path based on the Jws.exe file

Important NOTES:
You must specify and create two private folders for Jexus: One is the log folder that holds the log files, and one is the site configuration folder that holds the Web site configuration file.
The log folder must have write rights to the Jexus system, as it writes Jexus system logs, Web site access logs, and so on, and a folder has been built in the installer with the name log.
The Site configuration folder is the place where the site configuration files are stored (the folder is already built in the installation package, and the name is siteconf), so that only one site and this folder must be available, since Jexus will read the contents of the site configuration from this folder when it starts.
That is, by default, the folder structure of Jexus is:
/usr/jexus #JWS工作目录
/usr/jexus/siteconf #网站配置目录
/usr/jexus/log #日志目录 Second, the site configurationJexus support multi-site, you can use a different port, domain name, virtual path to set any number of sites.
All site configuration files must be placed in the jws.conf specified Web site configuration folder (this folder often JWs working directory "siteconf" folder), this folder in addition to the website configuration file, no other files, Because Jexus would think that any file here represents a different website.
Each site has and only one profile, the profile filename is the name of the site, such as www.mysite.cn this site, the configuration file name can be written as "MySite", of course, can also be written in other filenames, so that administrators easy to remember and identify, But pay special attention: The file name cannot have spaces!
A website can have any number of domain names, different websites can not have the same domain name, no domain name of the site can only have one, this no domain name of the site is called "Default Site", and a server can only have one default website.

* * * re-emphasized:
1. The file name of the Web site profile cannot have spaces;
2, the Site configuration folder can only have a website configuration file, there can be no other file files exist.

Below take www.mysite.cn as an example, say the configuration of the website
To create a file in the Site configuration folder, the name of the file should have some meaning (at least let the server administrator know which site this profile belongs to)
The file name of the configuration file for this website is: MySite

sudo vim MySite

A, the basic content of the website configuration:
PORT=80 # Jexus Web server listening port (required.) Of course it can be another port)
root=//var/www/mysite # Site URL root path (virtual directory) and corresponding physical path, two path strings must be separated by a space (required). Even make this site a purely reverse proxy station, also need to fill in)

#可选项
hosts=mysite.cn,www.mysite.cn # Website domain name (recommended), you can use a generic domain name, such as: *.mysite.cn (do not fill out this entry or just fill in a "*" number means that this is the default site, a port can only have a default station)
Indexs=index.aspx,index.htm # Home File name, you can write multiple, separated by commas (can not fill.) Because the JWS system contains a common first name)
addr=0.0.0.0 # Binds to an IP address of the server's native, which by default is all addresses, or "0.0.0.0".
ASPNET_EXTS=MSPX,TTT # Add a new or custom ASP. Net extension (not recommended). Multiple extensions are separated by commas, without adding a number. System contains common extensions)

B, minimalist configuration example
Minimal configuration requires only port and root two items, such as:
Port=80
root=//var/www/default
Note: The meaning of the above two entries: "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 the website is "/" and the absolute path of the corresponding physical folder is "/var/ Www/default ", that is, the content of the site must be placed in the"/var/www/default "folder.

C. Advanced options for Site configuration (read suggestions: Suggest beginners skip this section)
The Advanced options for site configuration are all optional and should be selected according to the actual needs of the site.
With the flexibility to use advanced options, you can set up a unique, powerful server platform or server group.

1. Using the URL rewrite feature
URL rewriting means that the Web server interprets and matches the request URL path resource of the visitor to another real Rul path resource according to the specified matching rules.

For example, when you want someone to access a ". php" type of file, the server returns/404.html this file:
Rewrite=^/.+?\. (asp|php|cgi) $/404.html
Format
# "Rewrite=" is followed by a two-part block, separated by a space between the two parts.
Before a space is a matching condition: a regular expression is used to describe the matching condition of the URL.
A space is followed by a matching target: refers to which rule the server responds to if the user accesses a path that matches the previous match criteria.

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 explanation: Rewrite has two parts after the equal sign, separated by an empty compartment. The first half is a regular expression that describes the URL path style that requires URL rewriting (in the user's browser), and the second part is the real URL path that JWS should rewrite and access when the user's URL conforms to the preceding regular expression.

2. Prohibit or allow an IP or IP segment to access the website
A. Allow only certain IP addresses to access the website (Whitelist feature)
By default, all IP addresses are allowed to be accessed. If the IP address whitelist is set manually, the IP address outside the whitelist is automatically blacklisted.
Configuration format, such as:
allowfrom=1.2.3.*
allowfrom=2.2.3.3
B, prohibit a certain IP or IP access to the website (blacklist function)
By default, this configuration is empty. If you manually add IP addresses (segments) that need to be blocked, you must conform to a rule: The blacklist must be a true subset of the whitelist.
Configuration format, such as:
denyfrom=111.222.111.*
denyfrom=101.201.1.132

3. Prohibit access to content in a folder and its subfolders
denydirs= URL path to the Web site folder path, such as "/abcfiles" or "~/abcfiles", multiple paths, separated by commas

4, whether the requested URL, such as security detection
This option defaults to True, which requires checking, unless you really need to turn off this option, otherwise you can not fill in the format as follows:
Checkquery=false
(Turning off this item can improve the speed of the server, but in the case of security, it is not recommended to turn it off)

5, Nofile (no file) function
Nofile=/mvc/controller.aspx
(Note: This is a unique feature of jexus, meaning that if the server does not have a file that the user wants to access, the server will use what file to answer it.) )
(Hint: After routing, the original URL path is stored in the Jexus unique server variable "X-real-uri")
(Tip: With this feature, or with the URL rewrite feature, you can completely isolate the URL path from the real path for information hiding and simplifying the URL.) )

6, NOLOG (no log) function
Nolog=yes
(Note: Disabling the site log feature can improve the processing speed of the Web server system, but it is also obvious that you are unable to learn more about the site's access.)

7. Long Connection switch
Keep_alive=true
Note: The default value for version V5.6.3 is true, which means that long connections are used by default and can not be filled.

8. Reverse proxy function
reproxy=/abc/http://www.xxxx.com:890/abc/
The value of the parameter is composed of the URL root path of the site and the root path of the target website URL, separated by an empty compartment.
* Tip: The target address of the reverse generation can be multiple, separated by commas, such as:
reproxy=/abc/http://192.168.0.3/abc/,http://192.168.0.4/abc/
At this point, when the user accesses the/abc/, Jexus will randomly select a server to access, to achieve load balancing or server cluster effect.

9, accept the services provided by fast-cgi
For TCP connections:
fastcgi.add= the IP address of the file name extension |tcp:fast-cgi service that requires fast-cgi processing: port
such as: fastcgi.add=php,php3|tcp:127.0.0.1:9000
For UNIX sockets:
fastcgi.add= file extension |socket: Path required fcgi processing
such as: Fastcgi.add=php,php3|socket:/tmp/phpsvr

10. Enable the GZIP compression feature
Usegzip=true #即UseGzip
Explanation: When this feature is enabled, when a user accesses files such as ". htm" ". js", Jexus will compress these files and send them to the user's browser, which will save more network bandwidth.

11, let Jexus work process and site work in the specified user rights (identity)
In jws.conf, add a phrase: A user name already exists in the httpd.user= system, such as Httpd.user=www-data

12. Let Jexus work process and ASP. 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 "to improve the response speed of website ASP and reduce server pressure
This is a unique feature of Jexus. The function is very strong, very practical.
This is done by adding "<%response.addheader" ("Pagecache-time", "60") to the ASPX page that requires the Web platform-level cache to be enabled, with the word ";%>" as the time-out, in seconds.

14. Enable HTTPS for secure SSL transfer
This function is to encrypt the data between the server and the customer, and improve the confidentiality during the data transfer. Please visit www.linuxdot.net for specific methods.

15. Enable multi-process parallel service
By default configuration, Jexus is working in single process mode, the advantage of single process is simple configuration, save memory, but the weakness is also obvious, for example, it is difficult to give full play to multi-CPU multi-core performance advantages, large concurrency endurance, more disaster tolerant process weak and so on.
Therefore, the multi-CPU (CORE) on the server to open multiple processes, to improve processing speed, large concurrent load capacity and service stability and fault-tolerant ability.
How to open multiple worker processes: Modify the httpd.processes line in the jws.conf file, remove the # number from the front, and then fill in the number of processes that need to be turned on (no more than +1 CPU cores, and no more than 8).
Emphasis: After opening multi-process, ASP. NET website Session State service can no longer use InProc mode, but should use "StateServer" and other modes and configure "MachineKey" in Web. config, otherwise the session data loss and so on.

16. Limit the consumption of memory and CPU resources per worker process
This is the 5.5-enabled parameter, which is set in the jws.conf format.
httpd. Maxtotalmemory= the total amount of physical memory that can be consumed by all worker processes. The units are "megabytes", and the range of values available is an integer of the physical memory size that the 256-server can use, while the average to each worker process cannot be less than 128m,0 represented by the Jexus automatically set according to the size of the physical memory.
httpd. Maxcputime= the total amount of time that a single worker process can consume CPU resources. The unit is "seconds" and the desired value range is 300-14400 integers. 0 means disable this item Third, Operation Jexus 1. Basic Operation:
Commands such as the original Jws.start have been merged into a single command in Jexus V5.6.3, "JWs", which is a shell script file.

command parameters and corresponding effects:
JWs start: Start Jexus;
JWs Start site name: Launches the specified Web site
JWs Restart: Restart Jexus
JWs Restart site Name: Restart the specified Web site
JWs Stop: Stop Jexus
JWs Stop site Name: Stop the specified Web site
JWS REGSVR: Registers the global assembly required for Jexus (This command is only used after installing or updating Jexus, and must be used once).
Is the JWs Status:jexus in operation
Jws-v: Displays the version number of the Jexus

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

2. Allow Jexus to start automatically with the start of the server:
By adding "/usr/jexus/jws start" line to the/etc/rc.local file. Note that the path should be the actual path to JWS in your system, and do not write the path incorrectly. Iv. unloading Jexus1. In the rc.local file, delete the command line that you manually added to start the boot Jexus (if you have not added it, this step does not have to do)
2, delete the Jexus folder and all the contents (it is recommended to delete only *.exe and *.dll, other, such as Web site configuration files, etc. do not need to be removed for future re-enable).

Jexus-5.6.3 using a detailed, Jexus WEB server configuration

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.