Howto: Apache adding new modules

by on January 25, 2006 · 2 comments· LAST UPDATED January 25, 2006

in

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/mod_session.so

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 mod_foo.so outside of the Apache source tree using apxs:

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

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/mymodule.so

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.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 2 comments… read them below or add one }

1 Narendra Sai Kumar January 17, 2008 at 5:18 am

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

Reply

2 Rahul May 23, 2012 at 4:56 pm

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….

Reply

Leave a Comment

Previous post:

Next post: