In this guide, we will walk through installing an Apache Module that is not already included within cPanel's repositories. This guide is provided as informational, and cPanel's support team cannot assist with the installation of modules, nor can they assist with any errors that may arise due to installing these modules.
Some of the steps below may not be required if the module is already built as an RPM. For this guide, however, we are assuming that you will need to build the module.
The first thing we will need to do to install custom Apache Modules is to ensure that the Apache development packages are installed. To do so, run the command below:
yum install ea-apache24-devel
Next, we will need to create a directory to hold the custom module itself; This can be any directory you choose, but I recommend using a directory to make it easy to find later. In my case, I used
Now download the appropriate Module files to your server at that location. The exact method will vary based on where the module is maintained. For a GitHub hosted module, the download command would be similar to the following:
git clone https://github.com/user/repository.git /opt/cpanel/apache_modules/module_name
Now that the module files are present within your server, we will need to build them against your Apache installation; This can be done simply using the apxs utility. The below example assumes the module was written in C:
apxs -ci /opt/cpanel/apache_modules/module_name/module_file.c
Now that the module is built against your Apache installation, we will need to include it in the running configuration. There are two methods of performing this.
The first is to add the LoadModule lines to the pre_main_global.conf Apache include. Modification of this include is discussed in our Include Editor documentation.
The second, and recommended method, is to create a Module Configuration file at the following location:
Where ### is the order relative to the other modules that you wish to load the module, and modulename is the module's name.
Once you are satisfied with the above configurations rebuild the Apache configuration
If this completed without error you can then restart apache
Finally, check to ensure the module is loaded into the running configuration with
httpd -M|grep modulename
With that completed, you can begin using the module in your pages and other configurations!