Install mod_cloudflare on CWP Apache Web Server

mod_cloudflare Apache module will restore the remote ip and it will also fix https issue with Cloudflare flexible ssl.

Based on mod_remoteip.c, this Apache extension will replace the remote_ip variable in user’s logs with the correct remote IP sent from CloudFlare. The module only performs the IP substitution for requests originating from CloudFlare IPs by default.

In addition to this, the extension will also set the HTTPS environment variable to “on” in cases where Flexible SSL is in use. This prevents software such as WordPress from being broken by Flexible SSL.

Cloudflare Restoring original visitor IPs with mod_remoteip in CWP/Apache

To install,  Follow this steps :

Step one install required dependencies :

yum install libtool git -y

Download C Lone cloudflare Apache module from git :

cd /usr/local/src
git clone https://github.com/cloudflare/mod_cloudflare.git && cd mod_cloudflare

Install Mod_cloudflare :

/usr/local/apache/bin/apxs -a -i -c mod_cloudflare.c

Restart apache service and check the module installed or not :

service httpd restart && /usr/local/apache/bin/httpd -M|grep cloudflare

eg. output :

[root@srv mod_cloudflare]# service httpd restart && /usr/local/apache/bin/httpd -M|grep cloudflare
Redirecting to /bin/systemctl restart httpd.service
 cloudflare_module (shared)
Back to top button