cPanel INSTALLATIONS

Install mod_remoteip on cPanel

Install mod_remoteip
Install mod_remoteip

Install mod_remoteip on cPanel

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
wget https://documentation.cpanel.net/download/attachments/2326651/custom_opt_mod-remoteip.tgz
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

 
/scripts/easyapache

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
RemoteIPInternalProxy SERVER_IP_ADDRESS

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
RemoteIPTrustedProxy 127.0.0.1 SERVER_IP_ADDRESS

EasyApache 3

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

EasyApache 4

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

Sample Configuration:

 
# VERSION 0.1
LoadModule remoteip_module modules/mod_remoteip.so

<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.
 # 
 # https://httpd.apache.org/docs/trunk/mod/mod_remoteip.html
 # ---------------------------------------------------------
 RemoteIPHeader X-Real-IP
 RemoteIPInternalProxy 138.25.67.187
 # RemoteIPProxiesHeader X-Forwarded-By
 # RemoteIPTrustedProxy proxy.example.com
 # RemoteIPTrustedProxyList conf/trusted-proxies.lst
</IfModule>

Restart the Apache.

 
/etc/init.d/httpd restart

That’s it!

Read More:

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

Add Comment

Click here to post a comment

Topics