Apache – Global Environment Configuration

Apache – Global Environment Configuration

The global environment section of the configuration file contains directives which affect the overall operation of the Apache HTTP Server, such as the number of concurrent requests it can handle and the locations of the various files.

ServerRoot

The ServerRoot is the top-level directory which contains the server’s files. Both the secure server and the non-secure server set the ServerRoot directive is set to “/etc/httpd”.

ScoreBoardFile

The ScoreBoardFile stores internal server process information, which is used for communication between the parent server process and its child processes. Red Hat Linux uses shared memory to store the ScoreBoardFile.

Default : /etc/httpd/logs/apache_runtime_status

PidFile

PidFile names the file where the server records its process ID (PID).

Default: /var/run/httpd.pid

Timeout

Timeout defines, in seconds, the amount of time that the server will wait for receipts and transmissions during communications. Specifically, Timeout defines how long the server will wait to receive a GET request, how long it will wait to receive TCP packets on a POST or PUT request, and how long it will wait between ACKs responding to TCP packets.

Default : 300 seconds

KeepAlive

KeepAlive sets whether the server will allow more than one request per connection and can be used to prevent any one client from consuming too much of the server’s resources.

Keepalive is set to off. If Keepalive is set to on and the server becomes very busy, the server can quickly spawn the maximum number of child processes. In this situation, the server will slow down significantly. If Keepalive is enabled, it is a good idea to set the the KeepAliveTimeout low and monitor the /var/log/httpd/error_log log file on the server. This log reports when the server is running out of child processes.

Default : off

MaxKeepAliveRequests

This directive sets the maximum number of requests allowed per persistent connection. The Apache Project recommends a high setting, which improves the server’s performance.

Default : 100

KeepAliveTimeout

KeepAliveTimeout sets the number of seconds the server will wait after a request has been served before it closes the connection. Once the server receives a request, the Timeout directive applies instead.

Default :15 seconds

MinSpareServers and MaxSpareServers

The Apache HTTP Server dynamically adapts to the perceived load by maintaining an appropriate number of spare server processes based on the traffic. The server checks the number of servers waiting for a request and kills some if there are more than MaxSpareServers or creates some if the number of servers is less than MinSpareServers.

The value is; the default MaxSpareServers value is 20. These default settings should be appropriate in most situations. Be careful not to increase the MinSpareServers to a large number as doing so will create a heavy processing load on the server even when traffic is light.

Default MinSpareServers : 5

Default MaxSpareServers : 20

StartServers

StartServers sets how many server processes are created upon startup. Since the Web server dynamically kills and creates server processes based on traffic load, it is not necessary to change this parameter. The Web server is set to start eight server processes at startup.

Default : 8

MaxClients

MaxClients sets a limit on the total number of server processes, or simultaneously connected clients, that can run at one time. The main purpose of this directive is to keep a runaway Apache HTTP Server from crashing the operating system. For busy servers this value should be set to a high value.

It is not recommended this the value for the MaxClients exceed 256.

Default : 150

MaxRequestsPerChild

MaxRequestsPerChild sets the total number of requests each child server process serves before the child dies. The main reason for setting MaxRequestsPerChild is to avoid long-lived process induced memory leaks. Default: 1000

Listen

The Listen command identifies the ports on which the Web server will accept incoming requests. By default, the Apache HTTP Server is set to listen to port 80 for non-secure Web communications and (in the /etc/httpd/conf.d/ssl.conf which defines any secure servers) to port 443 for secure Web communications.

If the Apache HTTP Server is configured to listen to a port under 1024, the root user to start it. For port 1024 and above, httpd can be started as a regular user.

The Listen directive can also be used to specify particular IP addresses over which the server will accept connections.

Default (for non-secure Web communications): 80

Default (for secure Web communications): 443

LoadModule

LoadModule is used to load in Dynamic Shared Object (DSO) modules Load order is no longer important in Apache2.0.0.

ExtendedStatus

The ExtendedStatus directive controls whether Apache generates basic (off) or detailed server status information (on), when the server-status handler is called. The Server-status handler is called using Location tags.

Related Articles on Apache :-

Apache Main Server Configuration

Features of Apache HTTP Server 2.0

Apache Global Environment Configuration

Apache Virtual Hosts Configuration

Securing Apache / http server

Apache Installation

Sharing