Apache httpd.conf Detailed (very useful)

Source: Internet
Author: User
Tags address apache change client copy directory exit file

ServerRoot "/ usr / local"

ServerRoot used to specify the daemon httpd running directory, httpd will automatically change the current directory of the process to this directory after startup, so if the file or directory specified in the setup file is a relative path, then the real path is in this ServerRotot definition Under the path.

ScoreBoardFile /var/run/httpd.scoreboard

httpd uses ScoreBoardFile to maintain the process's internal data, so you generally do not need to change this parameter unless the administrator wants to run several Apache servers on one computer, each Apache server requires a separate setup file, htt pd.conf, And use a different ScoreBoardFile.

#ResourceConfig conf / srm.conf
#AccessConfig conf / access.conf

These two parameters, ResourceConfig and AccessConfig, are for compatibility with older versions of Apache that use srm.conf and access.conf settings. If there is no compatibility requirement, you can specify the corresponding settings file as / dev / null, which means that no other settings file exists and only one file is used to save all the settings options.

PidFile /var/run/httpd.pid

The file specified by PidFile will record the process ID of the httpd daemon. Since httpd can copy itself automatically, there are multiple httpd processes in the system, but only one process is the one originally started, which is the parent process of other processes. The process of sending signals will affect all the httpd process. The file that is defined by PidFILE records the process number of the httpd parent process.

Timeout 300

Timeout Defines the timeout interval between client and server connections beyond which the server disconnects from the client after this interval (in seconds).

KeepAlive On

In HTTP 1.0, a connection can only make HTTP requests once, and the KeepAlive parameter is used to support HTTP 1.1 versions of one-time, multiple-transfer functionality so that multiple HTTP requests can be delivered in one connection. Although only newer browsers support this feature, it is still open to use this option.

MaxKeepAliveRequests 100

MaxKeepAliveRequests The maximum number of HTTP requests that can be made for a connection. Setting this value to 0 will support unlimited transfer requests within a single connection. In fact, no client requests too many pages in a single connection, and the connection is usually not reached until this limit is reached.

KeepAliveTimeout 15

KeepAliveTimeout Test a connection between multiple requests for transmission time, if the server has completed a request, but has not received the client's next request, after the interval exceeds the value of this parameter set, the server is disconnected connection.

ThreadsPerChild 50
Set the number of servers to use the process.
# This is based on the server's response speed, the number is too large will slow MaxRequestsPerChild 30

The use of sub-processes to provide services to the Web service, a common approach is a sub-process for a connection service, this creates the problem is that each connection needs to be generated, exit the sub-process system operations, making these additional processing occupy A lot of computer processing power. So the best way is that a child process can service requests for multiple connections, so that you do not need these build, exit the process of system consumption, Apache uses this approach, a connection is completed, the child process does not exit, and Is to stay in the system waiting for the next service request, thus greatly improving the performance.

However, due to the process of sub-processes to continue to apply for and release of memory, the more the number of garbage will cause some memory, it will affect the stability of the system, and affect the effective use of system resources. Therefore, after a copy has processed a certain number of requests, it is possible to exit the copy of this subprocess and copy a clean copy from the original htt pd process, thus improving the stability of the system. In this way, the number of service requests handled by each child process is defined by MaxRe questPerChild. The default setting is 30, a value that is too conservative for FreeBSD systems with high stability, set to 1000 or higher, and set to 0 to support an unlimited number of services per replica.
For security, set it to zero #Listen 3000
#Listen 12.34.56.78:80
#BindAddress *

The Listen parameter specifies that the server should monitor HTTP requests for other ports in addition to the standard 80 port. Because FreeBSD systems can have multiple IP addresses at the same time, you can also specify that the server listen only to HTTP requests for the IP address of a BindAddress </ B>. If you do not configure this one, the server will respond to all IP requests.

Even though the BindAddress parameter is used so that the server responds to requests for only one IP address, the HTTP daemon can still respond to requests for other IP addresses by using the extended Listen parameter. The Listen parameter is used the same as the second example above. This more complicated usage is mainly used to set up a virtual host. VirtualHost parameters can then be used to define virtual hosts for different IPs. However, this usage is a way to set up virtual hosts in the earlier HTTP 1.0 standard. For each virtual host, an IP address is needed, which is not actually useful. In HTTP 1.1, support for virtual hosts with multiple IP addresses and multiple domains has been added to make the setting of virtual hosts more meaningful.

#ExtendedStatus On

Apache server through a special HTTP request to report its own operating status, open the ExtendedStatus parameter allows the server to report more comprehensive operational status information -------------------- -------------------------------------------------- -----------

ServerAdmin you@your.address

The configuration file may only change ServerAdmin, this one is used to configure the WWW server administrator's email address, which will be returned to the browser in the HTTP service error conditions in order to allow Web users and administrators to contact, Report error. It is customary to use the webmaster on the server as the WWW server administrator to send the email sent to the webmaster to the real web administrator via the mail server's alias mechanism.

ServerName localhost

By default, this ServerName parameter does not need to be specified, and the server will automatically get its own name by name resolution process, but if the server has a name resolution problem (usually reverse-resolution incorrect) or no formal DNS name , You can also specify the IP address here. When ServerName is set incorrectly, the server can not start normally.

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.