mod_remoteip replaces the original client IP address for the connection with the UserAgent IP address. It is very useful if Apache is running behind a proxy. Please check out the steps to Install mod_remoteip on cPanel below.

If your cPanel server using EasyApache 3, please follow the steps below:

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

Rebuild Apache using EasyApache. You can find the mod_remoteip module is listed on the “Exhaustive Options List“. Also, please note that Apache 2.4 is needed to install mod_remoteip


install mod_remoteip


If your cPanel server using EasyApache 4, please follow the step below:

yum install ea-apache24-mod_remoteip

Common steps to follow after installing mod_remoteip:

Once the EasyApache Build is completed, you can verify the installation using the following command.

httpd -M | grep remoteip

Sample Output:

root@server [~]# httpd -M | grep remoteip
remoteip_module (shared)
root@server [~]#

Add the following configuration in mod_remoteip.conf

RemoteIPHeader X-Real-IP

Replace the SERVER_IP_ADDRESS with your server IP address. Also, you can try the following configuration to correct the client’s IP address passing to PHP.

RemoteIPHeader X-Forwarded-For

EasyApache 3

vim /usr/local/apache/conf/mod_remoteip.conf

EasyApache 4

vim /etc/apache2/conf.modules.d/360_mod_remoteip.conf

Sample Configuration:

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 X-Real-IP
# RemoteIPProxiesHeader X-Forwarded-By
# RemoteIPTrustedProxy
# RemoteIPTrustedProxyList conf/trusted-proxies.lst

Restart the Apache.

/etc/init.d/httpd restart

That’s it!

Was this answer helpful? 1 Users Found This Useful (2 Votes)