25.2.2. Migrating Apache HTTP Server 1.3 Configuration Files to 2.0
This section details migrating an Apache HTTP Server 1.3 configuration file to be utilized by Apache HTTP Server 2.0.
If upgrading to Red Hat Enterprise Linux 5 from Red Hat Enterprise Linux 2.1, note that the new stock configuration file for the Apache HTTP Server 2.0 package is installed as
/etc/httpd/conf/httpd.conf.rpmnew
and the original version 1.3 httpd.conf
is left untouched. It is entirely up to you whether to use the new configuration file and migrate the old settings to it, or use the existing file as a base and modify it to suit; however, some parts of the file have changed more than others and a mixed approach is generally the best. The stock configuration files for both version 1.3 and 2.0 are divided into three sections.
If the
/etc/httpd/conf/httpd.conf
file is a modified version of the newly installed default and a saved a copy of the original configuration file is available, it may be easiest to invoke the diff
command, as in the following example (logged in as root):
diff -u httpd.conf.orig httpd.conf | less
This command highlights any modifications made. If a copy of the original file is not available, extract it from an RPM package using the
rpm2cpio
and cpio
commands, as in the following example:
rpm2cpio apache-<version-number>.i386.rpm | cpio -i --make
In the above command, replace <version-number> with the version number for the
apache
package.
Finally, it is useful to know that the Apache HTTP Server has a testing mode to check for configuration errors. To use access it, type the following command:
apachectl configtest
25.2.2.1. 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. This section requires a large number of changes and should be based on the Apache HTTP Server 2.0 configuration file, while migrating the old settings into it.
25.2.2.1.1. Interface and Port Binding
The
BindAddress
and Port
directives no longer exist; their functionality is now provided by a more flexible Listen
directive.
If
Port 80
was set in the 1.3 version configuration file, change it to Listen 80
in the 2.0 configuration file. If Port
was set to some value other than 80, then append the port number to the contents of the ServerName
directive.
For example, the following is a sample Apache HTTP Server 1.3 directive:
Port 123 ServerName www.example.com
To migrate this setting to Apache HTTP Server 2.0, use the following structure:
Listen
123 ServerName www.example.com:123
For more on this topic, refer to the following documentation on the Apache Software Foundation's website:
25.2.2.1.2. Server-Pool Size Regulation
When the Apache HTTP Server accepts requests, it dispatches child processes or threads to handle them. This group of child processes or threads is known as a server-pool. Under Apache HTTP Server 2.0, the responsibility for creating and maintaining these server-pools has been abstracted to a group of modules called Multi-Processing Modules (MPMs). Unlike other modules, only one module from the MPM group can be loaded by the Apache HTTP Server. There are three MPM modules that ship with 2.0:
prefork
, worker
, and perchild
. Currently only the prefork
and worker
MPMs are available, although the perchild
MPM may be available at a later date.
The original Apache HTTP Server 1.3 behavior has been moved into the
prefork
MPM. The prefork
MPM accepts the same directives as Apache HTTP Server 1.3, so the following directives may be migrated directly:
StartServers
MinSpareServers
MaxSpareServers
MaxClients
MaxRequestsPerChild
The
worker
MPM implements a multi-process, multi-threaded server providing greater scalability. When using this MPM, requests are handled by threads, conserving system resources and allowing large numbers of requests to be served efficiently. Although some of the directives accepted by the worker
MPM are the same as those accepted by the prefork
MPM, the values for those directives should not be transferred directly from an Apache HTTP Server 1.3 installation. It is best to instead use the default values as a guide, then experiment to determine what values work best.
Important
To use the
worker
MPM, create the file /etc/sysconfig/httpd
and add the following directive:
HTTPD=/usr/sbin/httpd.worker
For more on the topic of MPMs, refer to the following documentation on the Apache Software Foundation's website:
25.2.2.1.3. Dynamic Shared Object (DSO) Support
There are many changes required here, and it is highly recommended that anyone trying to modify an Apache HTTP Server 1.3 configuration to suit version 2.0 (as opposed to migrating the changes into the version 2.0 configuration) copy this section from the stock Apache HTTP Server 2.0 configuration file.
Those who do not want to copy the section from the stock Apache HTTP Server 2.0 configuration should note the following:
- The
AddModule
andClearModuleList
directives no longer exist. These directives where used to ensure that modules could be enabled in the correct order. The Apache HTTP Server 2.0 API allows modules to specify their ordering, eliminating the need for these two directives. - The order of the
LoadModule
lines are no longer relevant in most cases. - Many modules have been added, removed, renamed, split up, or incorporated into others.
LoadModule
lines for modules packaged in their own RPMs (mod_ssl
,php
,mod_perl
, and the like) are no longer necessary as they can be found in their relevant files within the/etc/httpd/conf.d/
directory.- The various
HAVE_XXX
definitions are no longer defined.
Important
If modifying the original file, note that it is of paramount importance that the
httpd.conf
contains the following directive:
Include conf.d/*.conf
Omission of this directive results in the failure of all modules packaged in their own RPMs (such as
mod_perl
, php
, and mod_ssl
).
25.2.2.1.4. Other Global Environment Changes
The following directives have been removed from Apache HTTP Server 2.0's configuration:
ServerType
— The Apache HTTP Server can only be run asServerType standalone
making this directive irrelevant.AccessConfig
andResourceConfig
— These directives have been removed as they mirror the functionality of theInclude
directive. If theAccessConfig
andResourceConfig
directives are set, replace them withInclude
directives.To ensure that the files are read in the order implied by the older directives, theInclude
directives should be placed at the end of thehttpd.conf
, with the one corresponding toResourceConfig
preceding the one corresponding toAccessConfig
. If using the default values, include them explicitly asconf/srm.conf
andconf/access.conf
files.