Installing and Configuring mod_rpaf in apache2
mod_rpaf is the Reverse Proxy Add Forward module for apache. To install, follow the below steps
#1. install required packages
sudo apt install unzip build-essential apache2-dev
#2. download and install mod_rpaf
wget https://github.com/gnif/mod_rpaf/archive/stable.zip
unzip stable.zip
cd mod_rpaf-stable
make
sudo make install
#3. Add the module to apache config. Create the file
sudo vim /etc/apache2/mods-available/rpaf.load
#paste this line
LoadModule rpaf_module /usr/lib/apache2/modules/mod_rpaf.so
#4. Create the config file
sudo vim /etc/apache2/mods-available/rpaf.conf
#paste the below lines
<IfModule mod_rpaf.c>
RPAF_Enable On
RPAF_Header X-Real-Ip
RPAF_ProxyIPs your_server_ip
RPAF_SetHostName On
RPAF_SetHTTPS On
RPAF_SetPort On
</IfModule>
#5. Enable the module
sudo a2enmod rpaf
#6. Restart apache config
sudo apachectl -t
sudo systemctl reload apache2