Adding Modules to Your Server

Since the Apache HTTP Server 2.0 supports DSOs, you can easily load Apache modules or compile in your own modules. DSO support also means modules are dynamically loaded at runtime only as necessary, conserving memory resources on the server.

The Apache Group provides complete DSO Documentation at http://httpd.apache.org/docs-2.0/dso.html. After installation of the http-manual package, you can also check http://localhost/manual/mod/ for documentation on Apache modules.

For the Apache HTTP Server to use a dynamically shared module, that module must have a LoadModule line in httpd.conf.

A sample LoadModule line looks like this:

LoadModule access_module modules/mod_access.so

If you add or delete modules from http.conf, you must reload or restart Apache, as covered in the Section called Starting and Stopping httpd.

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. For this you need have the httpd-devel package installed because it contains the include files, the header files, and the APache eXtenSion (apxs) application. The apxs command uses the include files and the header files to compile Apaches modules.

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 http://httpd.apache.org/docs-2.0/dso.html and the apxs, man page.

Once you have compiled the module, put your module in the /usr/lib/httpd/ directory. Then add a LoadModule line to httpd.conf. 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/<mod_foo.so>

Note that you will need to change the name of <foo_module> and <mod_foo.so> as appropriate.

Once you have completed these 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.