Install mod_remoteip in Cpanel Server

To install mod_remoteip in Cpanel Server, run

yum install ea-apache24-mod_remoteip

Edit file

vi /etc/apache2/conf.modules.d/370_mod_remoteip.conf


RemoteIPHeader X-Forwarded-For

Restart Apache.

systemctl restart apache2

At this stage, PHP applications will show the proper visitor IP addresses.

Apache access logs will still show the proxy server IP. To fix this, edit the Apache configuration file.


LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

Replace with

LogFormat "%a %l %u %t \"%r\" %>s %b" common
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

Restart Apache

systemctl restart apache2

Cloudflare Restore Real IP Address in Cpanel Server

Back to Cpanel Server

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *