Original address: http://www.chaolang.com/study/apache/001.htm
The setup file of the Apache server is located in the / usr / local / apache / conf / directory, traditionally uses three configuration files httpd.conf, access.conf, and srm.conf to configure the behavior of the Apache server. Httpd.conf provides the most basic server configuration, which is a technical description of how the daemon HTTPD is running; SRM.CONF is the server's resource mapping file, telling the MIME type of the server, and how to support these files; access.conf Used to configure access to servers, control access restrictions of different users and computers; these three configuration files control all of the features of the server, so these three files need to be set to normal running the server. In addition to these three setup files, Apache also uses mime.types files to identify MIME types corresponding to different files, and the MAGIC file sets some special identifiers for different MIME type files, making the Apache server from the document suffix cannot determine the MIME of the file. When the type, the MIME type of the document can be determined by these special tags in the file content. Bash-2.02 $ ls -l / usr / local / apache / conftotal 100-RW-R - R - 1 root Wheel 348 APR 16 16:01 Access.conf-rw-r - r - r - 1 root Wheel 348 Feb 13 13:33 Access.conf.default-rw-r - r - 1 Root Wheel 30331 May 26 08:55 httpd.conf-rw-r - r - 1 root wheel 29953 Feb 13 13:33 httpd .conf.default-rw-r - r - 1 root Wheel 12441 APR 19 15:42 Magic-rw-r - r - r - r - 1 Root Wheel 12441 Feb 13 13:33 MAGIC.DEFAULT-RW-R - R - 1 Root Wheel 7334 Feb 13 13:33 Mime.Types-RW-R - R - 1 Root Wheel 383 May 13 17:01 Srm.conf-RW-R - R - ROOT WHEEL 357 Feb 13 13:33 Srm.conf.default in fact the current version of Apache will originally httpd.conf, SRM.CONF and all the configuration parameters in Access.conf are in a configuration file httpd.conf, just for the former The reasons for version compatibility (using these three settings files from NCSA-HTTPD) only use three profiles. There is no specific settings in the access.conf and SRM.conf files. Since all settings are placed in httpd.conf in the new version of Apache, they only need to adjust the settings in this file. The following uses the default httpd.conf as an example to explain the setting options of the Apache server. However, it is not necessary because it provides settings to set the parameters, basically these parameters are clear, or they can run the Apache server without modifying. However, if you need to adjust the performance of the Apache server, and add support for some feature, you need to understand the meaning of these setting parameters. Regarding the performance of the Apache server, there is a big controversy on the Internet. Basically, the user who uses Apache almost does not doubt its excellent performance, and Apache has also supported a lot of famous high-load websites, but in the assessment of commercial institutions. Apache tends to score. Many people pointed out that in these reviews, commercial web servers and their operating systems often perform performance adjustments by engineers from their professional companies, and free operating systems and web servers often use their default configuration or only small changes. .
It should be pointed out that in addition to the performance adjustment of the operating system, the default configuration of the Apache server itself is never optimized and most efficient, but to adapt to almost all kinds of operating systems, all kinds of hardware settings, multi-platform Software is not possible to provide optimized default configurations for specific platforms and specific hardware. Therefore, performance adjustments are essential when using Apache. Another fact that is ignored in business evaluation is that different types of functions are often compared, for example, using Apache's standard CGI performance compared to ISAPI, NSAPI, etc., in fact Apache servers can be compared Function is modper, fastcgi, similar to the ASP is a PHP, etc. However, in the evaluation, the tester did not join the corresponding module to evaluate its performance. The operating parameters of the HTTP daemon first define the parameters required to run when the HTTPD daemon runtime is defined to determine its operational mode and the operating environment. ServerType Standalone Servertype Defines the server's startup method, default is independent mode Standalone, and the HTTPD server will start by itself and reside in the host to monitor connection requests. This way is a recommended settings in the launch file /etc/rc.d/rc.local/init.d/apache under Linux. Another way to start the Apache server is the inet mode, using the Super Server INETD to monitor the connection request and start the server. When you need to use the inetd startup mode, you need to change to this setting, and mask the /etc/rc.d/rc.local/init.d/apache file, and change /etc/inetd.conf and restart inetd, then apache Can start from inetd. The difference between the two ways is that the independent method is managed by the server itself, which can immediately start multiple copies of the server immediately, each copy resides in memory, and a connection request does not need to generate a sub-process. It can be handled immediately, and the request for the customer browser is faster and the performance is high. The inetd method is to start the HTTP server after the connection request is found by inetd. Since inetd is listening to too many ports, the reaction is slower, the efficiency is low, but saves the resources that the web server occupied when there is no connection request. Therefore, inetd is only used by occasionally accessing and does not require access to a server. In fact, the inetd method is not suitable for http's burst and multi-connection characteristics, because a page may contain multiple images, while each image can cause a connection request, even though the number of visitors teach less, but instantaneous connection request Many, this is limited by inetd performance, and even other server programs started by inetd. ServerRoot "/ usr / local" serverroot is used to specify the run directory of the daemon httpd. HTTPD will automatically change the current directory of the process after startup, so if the file or directory specified in the setup file is relative path, then true The path is located under the path defined by this ServerRoot. Since HTTPD often makes concurrent file operations, you need to use a locking method to ensure that the file operation does not conflict, because the NFS file system is limited in the file lock, so this directory should be a local disk file system, and should not be used NFS file system.