Let’s start the week with a very easy tutorial with mod_rpaf. Today you will learn what is mod_rpaf and how to install Mod_Rpaf on cPanel based servers.
Rpaf means reverse proxy add forward, and mod_rpaf is a module designed for backend Apache servers. It’s useful when you are running for example Varnish or Nginx as front end server, and you need to get the real IP of your backend requests.
If you don’t use mod_rpaf for your web server, you won’t be able to catch the real IP address of your visitors, this is bad for system and seo statistics.
The previous graphic represents a common proxy diagram, where the first element are your visitors, who come from Internet. The second one is your proxy server (Varnish or Nginx), and the last one is your real Apache web server.
How can I install Mod_Rpaf on cPanel servers?
Two mod_rpaf options are available:
- The original devs of mod_rpaf: https://github.com/gnif/mod_rpaf
- And a fork, with better stuff than the original: https://github.com/y-ken/mod_rpaf
We will use the last one, the fork, to install mod_rpaf, as it works pretty well on cPanel servers and we never had any problem using it. Let’s begin.
Login to your box as root and download the rpaf module
cd /root wget https://github.com/y-ken/mod_rpaf/archive/master.zip unzip master.zip
Now let’s compile the module
cd mod_rpaf-master/ apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
Finally, add the module to install Mod_rpaf on cPanel
LoadModule rpaf_module modules/mod_rpaf-2.0.so <IfModule mod_rpaf-2.0.c> RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 xx.xx.xx.xx </IfModule>
Restart Apache to apply the changes:
service httpd restart
As you see, you can install mod_rpaf on cPanel in just a few minutes, the setup is pretty much easy, and after your mod_rpaf is installed you should be able to get your real visitor’s IP address without any problems.
Please let us know if you have any questions about mod_rpaf setup on cPanel.