Apache Server Configuration Overview (2)

Source: Internet
Author: User
Article Title: Apache Server Configuration Overview (2 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
MinSpareServers 5
MaxSpareServers 10
  
On the Web server that uses a sub-process to process HTTP requests, the response time is delayed because the sub-process must be generated first to process the customer's requests. However, the Apache server uses a special technique to get rid of this problem. This means that multiple idle sub-processes are generated in advance and reside in the system. Once a request appears, immediately use these idle sub-processes for processing, so that there is no latency caused by the generation of sub-processes. As client requests increase, the number of sub-processes started increases. However, these server copies do not exit immediately after an HTTP request is processed, instead, wait in the computer for the next request. However, the number of idle sub-process Replicas cannot be increased or decreased. Too many idle sub-processes do not process tasks and occupy the server's processing capabilities. Therefore, the number of idle copies must be limited, maintain a proper number of processes so that you can respond to customer requests in a timely manner and reduce the number of unnecessary processes.
  
Therefore, you can use the MinSpareServers parameter to set the minimum number of idle sub-processes, and use the MaxSpareServers parameter to limit the maximum number of idle sub-processes. Redundant server process copies will exit. Set according to the actual situation of the server. If the server has high performance and is frequently accessed, you should increase the settings of these two parameters. For high-load professional websites, these two values should be roughly the same, and are equivalent to the maximum number of server replicas supported by the system, and unnecessary copies should be removed.
  
StartServers 5
  
The StartServers parameter is used to set the number of subprocess replicas started at httpd startup. this parameter is related to the MinSpareServers and MaxSpareServers parameters defined above, it is used to start idle sub-processes to speed up server response. This parameter should be set to a value between the first two values, which is less than MinSpareServers and greater than MaxS pareServers.
  
  
MaxClients 150
  
On the other hand, the server's capabilities are limited after all, and it is impossible to process an infinite number of connection requests at the same time. Therefore, the Maxclient s parameter is used to specify the maximum number of concurrent access customers supported by the server, if this value is set too large, the system has to switch between too many processes during busy hours to serve too many customers. This slows down the response to each customer, and reduced the overall efficiency. If this value is set to a small value, some customer connection requests will be rejected when the system is busy. When the server performance is high, you can add this setting as appropriate. For professional websites, the policy to improve server efficiency should be used. Therefore, this parameter cannot exceed the hardware limit. If access is frequently denied, the server hardware needs to be upgraded. For non-professional websites, users are not very concerned about the response speed to the customer's browser, or think that the response speed is slower than that of the rejected connection. This parameter can also be set slightly beyond the hardware conditions.
  
This parameter limits the settings of MinSpareServers and MaxSpareServers. They should not be greater than the settings of this parameter.
  
MaxRequestsPerChild 30
  
A sub-process is a commonly used method for providing Web services. A sub-process is a connection service, the problem is that each connection requires system operations to generate and exit sub-processes, so that these additional processes occupy a large amount of processing capabilities of the computer. Therefore, the best way is that a sub-process can connect to the service for multiple times, so that the system consumption of the generated and exited processes is not required. Apache uses this method. After a connection is completed, the sub-process does not exit, but stays in the system waiting for the next service request, which greatly improves the performance.
  
However, due to the constant application and release of memory in the processing process, a large number of times may cause some memory spam, which will affect the system stability and the effective use of system resources. Therefore, after a copy has been processed for a certain number of requests, the sub-process can exit the copy and re-copy a clean copy from the original httpd process, in this way, the system stability can be improved. In this way, the number of service requests processed by each sub-process is defined by MaxRe questPerChild. The default value is 30. This value is too conservative for Linux systems with high stability and can be set to 1000 or higher, set to 0 to support unlimited service processing for each copy.
  
# Listen 3000.
  
# Listen 12.34.56.78: 80
  
# BindAddress *
  
The Listen parameter allows the server to monitor HTTP requests from other ports in addition to the standard port 80. Because the FreeBSD system can have multiple IP addresses at the same time, you can also specify that the server only listens to HTTP requests for the IP address of a BindAddress </B>. If this item is not configured, the server will respond to requests from all IP addresses.
  
Even if the BindAddress parameter is used, the server can only respond to requests from one IP address. However, by using the extended Listen parameter, the HTTP daemon can still respond to requests from other IP addresses. In this case, the Listen parameter is used in the same way as the second example above. This complex usage is mainly used to set up virtual hosts. The VirtualHost parameter can be used to define virtual hosts with different IP addresses. However, this method is used to set virtual hosts in the earlier HTTP 1.0 standard. Each virtual host requires an IP address, in fact, it is not very useful. In HTTP 1.1, the support for single-IP multi-domain virtual hosts is added, making the virtual host settings more meaningful.
  
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 that it can add new functions through new modules during compilation, it also shows that its module can dynamically load http service programs without loading unnecessary modules. To use the Dynamic loading Module of Apache, you only need to set the Load Module and AddModule parameters. This feature is the DSO (Dynamic Shared Object) feature of Apache, however, to make full use of the DSO feature is still not a simple task. Modifying the settings here may cause the server to fail to start normally. Therefore, if you do not want to add or reduce the features provided by the server, do not change the settings here.
  
The list above shows the modules supported by the default Apache server in Linux. In fact, many modules are unnecessary and unnecessary modules are not loaded into the memory. The module can be statically connected to the pache server, or dynamically loaded in this way. This Port is used to compile all Apache features into dynamic and loadable modules, rather than the default Apache approach, in this way, at the expense of a small amount of performance, it brings great flexibility.
  
Therefore, the ability to dynamically load has a slight impact on performance. Therefore, you can re-compile Apache and compile the functions you need into the Apache server to make the system clean, the efficiency has also been slightly improved. It is not necessary to recompile Apache for this purpose only. If you need to add other features and re-compile Apache, when adding other modules, you may wish to statically connect all modules to the Apache server. Some users prefer Dynamic Loading modules.
  
These modules are placed in the/usr/local/apache/libexec/directory, and each module corresponds to a feature of the Apache server. A detailed explanation of the functions of each module requires a considerable amount of space. The more important features will be explained in the following sections, for specific functions and usage of each module, You need to view the Apache documentation.
  
# ExtendedStatus On
  
The Apache server can report its own running status through special HTTP requests. Enabling this ExtendedStatus parameter allows the server to report more comprehensive running status information.
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.