Howto: Apache adding new modules

last updated in Categories News

Some one posted about, “What is Modules in Linux and how to add it in apache,” on our forum. Therefore, I decided to create a small howto for adding new modules under Apache. The Apache HTTP Server is a modular program. So as a UNNIX/Linux administrator you can choose the functionality to include in the server by selecting a set of modules (or features via modules).


A module provides variety of features for apache such as security, perl and php support etc. To configure apache for additional modules you need to add LoadModule directive in httpd.conf or modules.conf file. For example you can add session management and tracking through consistent identifiers using mod_session. You need to add following entry to Apache 1.3.xx server (under Debian Linux you need to add to /etc/apache-perl/modules.conf file):

LoadModule auth_module /usr/lib/apache/1.3/

Please note that your Apache server must configure for Dynamic Shared Objects (DSOs). Let us assume you have downloaded the module called mymodule.c and you would like to compile and use this module, then you can use Apache apxs utility to compile and install this module:

Build and install a third-party Apache module, say mod_foo.c, into its own DSO outside of the Apache source tree using apxs:

# apxs -c mymodule.c
# apxs -i -a -n mymodule

Then open your httpd.conf file and add mymodule using top LoadModule Directive:

# vi  httpd.conf

Append following line to server config context (this means that the directive may be used in the server configuration files (e.g., httpd.conf), but not within any or containers. It is not allowed in .htaccess files at all).

LoadModule mymodule /usr/lib/httpd/modules/

If you find compile and install procdure difficult to use then try Apachetoolbox utility to install your Apache modules easily. See official Apache documentation for more information.

If you are a Web developer then do not forget to check out book review of PHP Hacks Tips & Tools for Creating Dynamic Websites.


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

2 comment

  1. Surely this is very useful for all kinds of people who is working on apache. I appreciate this kind of how to documents.

  2. Good info…
    But need 2 add more details regarding

    How to add a module as static

    Thanks cyberciti u r helping me very much in my daily system works….

    Have a question? Post it on our forum!