Install mod_remoteip on cPanel to work with Incapsula – GK~Blog

Install mod_remoteip on cPanel to work with Incapsula

The reason you need to install mod_remoteip if you are working with Incapsula is because of all the traffic that comes to your website identified under the IP addresses of Incapsula network, What makes the website incoming statistics to be wrong.

mod_remoteip was designed to replaces the original client IP address for the connection with the useragent IP address list presented by a proxies or a load balancer via the request headers.

This solution is not only for Incapsula and can be used for any CDN solution proposed.

We chose in Incapsula as a quick and efficient CDN & Site Security service without the need to change the NS records of our domain, The price is not really cheap but they have a great product.

let’s start with the installation:

cd /var/cpanel/easy/apache/custom_opt_mods
tar -xvf custom_opt_mod-remoteip.tgz
rm -f custom_opt_mod-remoteip.tgz

To enable mod_remoteip, you must select Apache 2.4 and the mod_remoteip in the Exhaustive Options List section of the EasyApache in you WHM interface  Home >> Software >> EasyApache (Apache Update).

Then “Save and Build” And when EasyApache finishes you will need to edit the mod_remoteip configuration file.

vi /usr/local/apache/conf/mod_remoteip.conf

The file should look like this:

LoadModule remoteip_module modules/
<IfModule remoteip_module>
  # These settings are specific to your environment, so
  # we'll leave them commented out until you manually set
  # them. I recommend carefully reading the documentation 
  # as misconfiguration of this module can result in 
  # potential data compromise.
  # ---------------------------------------------------------
  RemoteIPHeader Incap-Client-IP
  RemoteIPProxiesHeader Incap-Client-IP

Restart Apache:

service httpd restart

And now that you have completed the installation and you are ready to work with Incapsula you can change your DNS records. 🙂