Install and enable Apache modules on debian / ubuntu

→ Are you a new visitor? Please visit the page guidance for new visitors ←

Install and enable Apache modules

In order for Apache to handle different situation or certain settings the user requires, certain modules are required to be installed and enabled. Usually Apache comes with most of the modules you require to work with installed, however there are certain cases where you need these modules to install first in order to be used. In such cases you would need to first install and enable Apache modules on your system in order to use them. In this article I’m going to show you how you can easily install and enable Apache modules step by step, the manual compile option would be interesting so do read below.

Install and enable Apache modules on Debian / Ubuntu

Debian and Ubuntu are kind enough to provide us with the default modules we need directly in their repository, however there are certain cases when you need to install the modules manually. We’ll get to that part a bit later.

To install the apache modules on Debian or Ubuntu directly from repository, you need to use the below commands:

you will see an output similar to bellow:

After apache has been restarted, you will be able to start using that module.

Enable or disable apache module

In case you want to disable or enable a module you can run the bellow command:

  • Enable apache module

  • Disable apache module

The process is easy, you just call the enable or disable command along with the apache module and finally restart your web server and you are done. Of course you need to be root to be able to execute the commands, you can use sudo in case you are not root.

Compiling Apache module

This process is a bit different and depends on each case or specific apache module. If you need a specific module to be compiled, please comment below and I’ll try to help out. For now, I’ll go with one specific module that exists in debian repository, but we will install it and enable it manually just to see how this process goes.

So for instance, we have the below commands to download and compile the RPAF module for reverse proxy:

As you can see below, we are using apxs2 to compile the apache module.

Next we need to create a configuration file for this module and enable the module and setup some basic settings. So create the file


Then edit this file and add the following settings:

The very first line is important, that will enable the module and we can use then the next settings. Most of the other modules have similar compiling methods, however there are cases where different requirements are needed. Most of the time these are specified in the module README file, so please do read that!

Of course you can create this configuration directly in the /etc/apache2/mods-available/ folder and use a2enmod command to enable the module, but since its a manual compile, I try to keep them separated.

That would be all for now, see you again in our next tutorial.

Request an article ←