Using the Apache module with a non-standard Apache2 install
Our Apache module is one of the recommended ways of integrating redirection.io in Web stacks. We distribute our Apache module for many distributions, which should cover most of the production cases.
However, it may happen that your hosting provider or provisionning solution installs a custom version of Apache, in non-standard paths or with incompatible dependencies.
This page will guide you through the steps to get our Apache module work with your Apache2 install, whatever its setup.
Download and build the module¶
apxsis installed on your system.
apxs(also known as "APache eXtenSion tool") is a tool for building and installing extension modules for the Apache server:
If this command does not return the full path of
apxs, you need to install it. This depends on your distribution, but basically you can get
apxsusing one of the following commands:
# Debian-based distribution apt install apache2-dev # RedHat-based distribution yum install httpd-devel
Download the module:
cd /tmp wget https://github.com/redirectionio/libapache2-mod-redirectionio/archive/master.zip
Then, simply build the module:
unzip master.zip cd libapache2-mod-redirectionio-master make
Install the module in the right path¶
Installing the module should be quite straightforward in most cases:
If this works, you're all set, congratulations! However, this step can fail if your Apache2 install does not use your distribution's standard Apache directories. In this case, you must copy the module to the appropriate folder.
First, find the modules folder. This can be done by inspecting the apache configuration:
/path/to/your/apache -V | grep SERVER_CONFIG_FILE # should display someting like: SERVER_CONFIG_FILE="/etc/apache-custom/httpd.conf" # which means the config file is "/etc/apache-custom/httpd.conf"
catto show the content of this file: you should notice several
LoadModuledirectives, for instance
LoadModule auth_basic_module lib/apache-custom/mod_auth_basic.so.
This means that the modules path is in
/etc/apache-custom/lib/apache-custom/. Hurra \o/
Move the module in this folder:
# change the module permissions chmod 644 ./src/.libs/mod_redirectionio.so # then, copy it to the right location # (of course, use the path that you have found above) sudo mv ./src/.libs/mod_redirectionio.so /etc/apache-custom/lib/apache-custom/
Load the module in Apache - for this, simply add a
httpd.conf, something like:
LoadModule redirectionio_module lib/apache-custom/mod_redirectionio.so
You may also want to add this line in a separate file, to keep track of your own changes. Most of the time, the main Apache2 configuration file includes other files (for example,
IncludeOptional /etc/apache-custom/conf.d/*.conf) - feel free to add your own!
reload Apache, and you're done!
sudo systemctl reload apache2.service
You can check that the module fully works by completing its configurations steps in the VirtualHost.