Howto: Apache adding new modules

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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Narendra Sai Kumar Jan 17, 2008 @ 5:18

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

  • Rahul May 23, 2012 @ 16:56

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum