Adding Modules to Your Server

Since Apache 1.3 supports DSOs, you can easily load Apache modules or compile in your own modules to your Web server. DSO support means that modules may be loaded at runtime. Since the modules are only loaded as necessary, they will not use any memory unless they are loaded.

The Apache Group provides complete DSO Documentation at After installation of your server, you can also check http://localhost/manual/mod/ for documentation on Apache modules in HTML format, if you installed the apache-manual package.

For Apache to use a dynamically shared module, that module must have a LoadModule line and an AddModule line in httpd.conf. By default, many modules have these two lines already included in httpd.conf, but a few of the less commonly used modules are commented out. The commented out modules were included during compilation, but they are not loaded by default.

If you need to use one of those non-loaded modules, look in the httpd.conf file to see all the available modules. Each of the available modules has a corresponding LoadModule line. To show you an example, the LoadModule section begins with these seven lines:

#LoadModule mmap_static_module modules/
LoadModule vhost_alias_module modules/
LoadModule env_module         modules/
LoadModule config_log_module  modules/
LoadModule agent_log_module   modules/
LoadModule referer_log_module modules/
#LoadModule mime_magic_module  modules/

Most of the lines are not commented out, indicating that each associated module was compiled in and is loaded in by default. The first line is commented out, which means that the corresponding module, mmap_static_module, was compiled in but not loaded.

To make Apache load an unloaded module, first uncomment the corresponding LoadModule line. For example, if you wanted to make Apache load in the mime_magic_module, uncomment this line:

#LoadModule mime_magic_module modules/

Next, you need to uncomment the corresponding line from the AddModule section in httpd.conf. To continue with our previous example, uncomment the mod_mime_magic line, which looks like the following:

#AddModule mod_mime_magic.c

Once you have uncommented the LoadModule and AddModule lines for the module that you want to reload or restart Apache, as covered in the Section called Starting and Stopping httpd. After restarting, the module should load.

If you have your own module, you can add it to the httpd.conf file so that it is compiled in and loaded as a DSO. You need the apache-devel package because it installs the include files, the header files and the APache eXtenSion (APXS) support tool. APXS uses the include files and the header files to compile your module so that it will work with Apache.

If you have written your own module or are using a third party module, you should be able to use APXS to compile your module sources outside the Apache source tree, without needing to tweak any compiler or linker flags. If you need more information on APXS, please see the Apache documentation at

Once you have compiled your module using APXS, put your module in the /usr/lib/apache/ directory. Then your module needs both a LoadModule line and an AddModule line in the httpd.conf file. After the LoadModule list in httpd.conf, add a line for the shared object file for your module like the following:

LoadModule foo_module 	modules/

Note that you will need to change the name of the module and the name of your shared object file as appropriate.

At the end of the AddModule list in httpd.conf, add a line for the source code file for your module like the following:

AddModule mod_foo.c

Note that you will need to change the name of the source code file as appropriate.

Once you have completed the previous steps, stop and start your Web server as outlined in the Section called Starting and Stopping httpd. If you have done everything correctly and your module is correctly coded, the Web server should find your module and load it in as it starts.

The mod_ssl Security Module

The mod_ssl security portion of the Web server is provided as a Dynamic Shared Object (DSO). This means that if you recompile the Apache Web server the EAPI extension patch from mod_ssl must be applied. Follow the instructions for building mod_ssl into Apache included with the mod_ssl documentation, but add the following flag:

./configure [userflags] --with-eapi-only

Then build and install Apache.


Red Hat cannot support re-compiled versions of the Apache Web server. Installation of the shipped version is supported, but if you re-compile Apache, you are on your own.