HomeApache Page 5 - Getting Started with Apache 2.0, Part 1
The "httpd.conf" Configuration File: a Quick Overview - Apache
In this first article in a three-part series, Harish Kamath helps you download and configure the Apache Web server. If you've wanted to use PHP with Apache, look no further; that part of the setup is also covered here.
In this section, I'll give you an overview of the "httpd.conf" file located under the "conf" folder of your Apache installation. As you might have guessed, you control the configuration of your Web server by manipulating the entries in this file.
While I'll refrain from commenting on the more complex features of this configuration file in this part of the tutorial, I will definitely cover the basic "parameters" with which you need to be familiar.
Open this httpd.conf in a text editor and scroll down to view the following parameters or "Directives," as they are commonly referred to as in Apache-lingo.
ServerRoot: this stores the folder under which the "conf" and "log" folders of your Apache installation are present.
PidFile: this specifies the name and location of the file where the server stores its process identification number when it starts. By default, the server creates a file called "httpd.pid" in the "logs" folder.
Timeout: this value represents the number of seconds the server sends a time out to the client.
KeepAlive: it is used to allow (or disallow) persistent connections, i.e. more than one request from clients for a single connection. It is recommended to keep this "On," the default value.
MaxKeepAliveRequests: this directive specifies the number of requests for a persistent connection.
KeepAliveTimeout: this parameter specifies the amount of time to wait (in seconds) for the subsequent requests from the client on a persistent connection.
Next, you'll notice a set of options for the different MPMs supported by your instance of Apache 2.0 version. Here, I'll recommend that you tweak with the "Directives" associated with the MPM that you have chosen to work with.
The following "Directives" follow:
Listen: this allows you to specifically bind the Web server to particular IP addresses and/or ports. This is useful if you would like to run different versions of Apache simultaneously, on the same machine, on different ports.
This is followed by the section where you can list DSO modules that you wish to load when the server starts. For example, if we wish to load the PHP5 module when the server starts, the following "LoadModule" entry is a must:
LoadModule php5_module modules/libphp5.so
The next two sections of the "httpd.conf" file deal with "main" server configuration and the "VirtualHosts" configured on your instance of Apache. For the moment, I shall avoid getting into specifics of these directives in today's article because of space constraints. But, I promise that I'll explain these in future tutorials of this Apache series.