Apache Server Configuration Full Introduction (II)

Source: Internet
Author: User
Tags exit http request connect numeric value requires client linux
apache| Server | Introduction Author: Wangbo

Minspareservers 5MaxSpareServers 10

On a Web server that uses a subprocess to process an HTTP request, the response time is slightly delayed because the child process is first built to process the customer's request. However, the Apache server uses a special technique to get rid of the problem, which is that the pre-generated multiple free child processes reside in the system and are immediately processed using these free subprocess once a request arises, so there is no delay caused by the build child process. As the number of client requests increases in the running, the child processes that are started are increased, but the server replicas do not exit immediately after processing an HTTP request, but stay on the computer for the next request. But the free copy of the child process does not increase the light without decreasing, too many free child processes do not process tasks and consume server processing power, so it is also necessary to limit the number of free copies so that they can be kept in a proper amount so that both the customer request and the unnecessary number of processes can be reduced.

Therefore, you can use parameter minspareservers to set the minimum number of free child processes, and

Using parameter maxspareservers to limit the maximum number of free child processes, redundant server process replicas exit. Set up according to the actual server, if the server performance is high, and also

is frequently accessed, you should increase the settings for these two parameters. For highly loaded professional web sites, these two values

Should be roughly the same, and equal to the maximum number of server replicas supported by the system, as well as unnecessary vice

This exit.


Startservers 5

The Startservers parameter is used to set the number of child process replicas that are started when the httpd is started, and this parameter is related to the minspareservers and maxspareservers parameters defined above and is used to initiate the idle subprocess to increase the server's response speed. This parameter should be set to a numeric value between the first two values, less than minspareservers and greater than maxs pareservers is meaningless.


MaxClients 150

On the other hand, the capacity of the server is limited after all, it is impossible to handle an unlimited number of connections at the same time

So the parameter maxclient s is used to specify the maximum number of concurrent clients that the server supports. If this value is set too large, the system will have to switch between too many processes at busy times to serve too much customers, slowing down the response to each customer and reducing overall efficiency. If this value is set to a lesser size, some client connection requests will be rejected when the system is busy. When server performance is high, you can increase the setting of this value appropriately. For professional Web sites, you should use a strategy to improve server efficiency, so this parameter cannot exceed the hardware itself, and if frequent denial of access occurs, you need to upgrade the server hardware. For the unprofessional web site, it is not too concerned about the response speed of the client browser, or that the reaction speed is slower than the refusal to connect better, you can also slightly exceed the hardware conditions to set this parameter.

This parameter restricts the minspareservers and maxspareservers settings, and they should not be large

To the setting of this parameter.


Maxrequestsperchild 30

A Web service that uses a subprocess to provide a service is a common way to connect a child process to a single connection, causing the problem that each connection requires a system operation to generate and exit the subprocess, making these additional processes occupy the computer's capacity for processing. So the best way to do this is to have a child process that can request services for multiple connections, this does not require these build, exit process system consumption, Apache in this way, once the connection is over, the child process does not quit, but stay in the system waiting for the next service request, which greatly improve performance.

However, as the process of processing the neutron process to continuously request and release memory, more than a few times will cause a

Some memory garbage, it will affect the stability of the system, and affect the efficient use of system resources. So after a certain number of requests have been processed by a copy, a copy of the child process can be exited and then the original

httpd a clean copy in the process, which can improve the stability of the system. This way, every

The number of child process service requests is defined by the Maxre questperchild. The default setting value is 30,

This value is too conservative for Linux systems with high stability characteristics and can be set to 1000 or higher, and set to 0 to support unlimited service processing for each replica.


#Listen 3000

#Listen 12.34.56.78:80

#BindAddress *

The Listen parameter can specify that the server monitors other ports in addition to the standard 80 ports

HTTP request. Because the FreeBSD system can have multiple IP addresses at the same time, you can also specify that the server listen only for HTTP requests to an IP address of a bindaddress</b>. If this is not configured, the server responds to requests for all IP.

Even if the bindaddress parameter is used, the server responds only to requests for one IP address, but by using the extended listen parameter, the HTTP daemon can still be allowed to respond to requests for other IP addresses. At this point the use of the Listen parameter is the same as the second example above. This more complex usage is primarily used to set up a virtual host. After that, you can define a virtual host for different IP with the VirtualHost parameter, but this usage is the method of setting up the virtual Host in the earlier HTTP 1.0 standard, each need an IP address for a virtual host, in fact it is not very useful. In HTTP 1.1, the support of the virtual host of single IP address multi domain is increased, which makes the setting of the virtual host more significant.


LoadModule Mime_magic_module libexec/apache/mod_mime_magic.so

LoadModule Info_module libexec/apache/mod_info.so

LoadModule Speling_module libexec/apache/mod_speling.so

LoadModule Proxy_module libexec/apache/libproxy.so

LoadModule Rewrite_module libexec/apache/mod_rewrite.so

LoadModule Anon_auth_module libexec/apache/mod_auth_anon.so

LoadModule Db_auth_module libexec/apache/mod_auth_db.so

LoadModule Digest_module libexec/apache/mod_digest.so

LoadModule Cern_meta_module libexec/apache/mod_cern_meta.so

LoadModule Expires_module libexec/apache/mod_expires.so

LoadModule Headers_module libexec/apache/mod_headers.so

LoadModule Usertrack_module libexec/apache/mod_usertrack.so

LoadModule Unique_id_module libexec/apache/mod_unique_id.so


Clearmodulelist

Addmodule mod_env.c

Addmodule mod_log_config.c

Addmodule MOD_MIME_MAGIC.C

Addmodule mod_mime.c

Addmodule MOD_NEGOTIATION.C

Addmodule MOD_STATUS.C

Addmodule mod_info.c

Addmodule mod_include.c

Addmodule mod_autoindex.c

Addmodule mod_dir.c

Addmodule MOD_CGI.C

Addmodule MOD_ASIS.C

Addmodule mod_imap.c

Addmodule MOD_ACTIONS.C

Addmodule mod_speling.c

Addmodule mod_userdir.c

Addmodule mod_proxy.c

Addmodule MOD_ALIAS.C

Addmodule mod_rewrite.c

Addmodule MOD_ACCESS.C

Addmodule mod_auth.c

Addmodule MOD_AUTH_ANON.C

Addmodule MOD_AUTH_DB.C

Addmodule mod_digest.c

Addmodule MOD_CERN_META.C

Addmodule MOD_EXPIRES.C

Addmodule MOD_HEADERS.C

Addmodule MOD_USERTRACK.C

Addmodule MOD_UNIQUE_ID.C

Addmodule mod_so.c

Addmodule MOD_SETENVIF.C


An important feature of the Apache server is its modular structure, which not only shows its ability to

New functions can be added through new modules, and their modules can be dynamically loaded into HTTP service

In order to not load unwanted modules. Using Apache dynamic loading modules requires only the load module and addmodule parameters to be set, which is the Apache DSO (Dynamic Shared Object) feature, However, to fully use the DSO feature is still not a simple thing, the improper changes in this setting may cause the server can not start normally. So if you're not adding or reducing the functionality that the server provides, don't change the settings here.


The above list shows the Linux default Apache server-supported modules, which are actually

Multiple modules are not necessary, and modules are not required to be loaded into memory. The module can be statically connected to the Pache server, or it can be dynamically loaded, and the Apache feature is compiled into a dynamic loadable module, rather than the Apache default approach, which offers great flexibility at the expense of very small performance.


So the ability to dynamically load or performance has a slight impact, so you can recompile Apache, the functionality you need to compile into the Apache server inside, you can make the system appear cleaner, the efficiency is slightly improved. It is usually not necessary to recompile Apache for this purpose only, and if additional features are needed to recompile Apache, all modules can be statically connected to the Apache server while additional modules are added. Some users prefer dynamic loading modules, so you may want to use dynamic loading modules all.


These modules are placed under the/usr/local/apache/libexec/directory and each module corresponds to one feature of the Apache server. It takes a considerable amount of space to explain the functionality of each module in detail, and the more important features will be explained in the appropriate place later, and the functionality and usage of each module requires viewing Apache documentation.


#ExtendedStatus on

The Apache server can report its running status through special HTTP requests, open this

The Extendedstatus parameter allows the server to report more comprehensive running state information.


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.