Install mod_cloudflare on CWP Apache Web Server

by Sandeep B.

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.

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)

If this post helps you in any way please consider a donation

Donate with PayPal :

md-donate

Donate with Paytm :

md-donate

You may also like

4 comments

Tnow July 26, 2019 - 12:44 pm Reply
Sandy July 27, 2019 - 9:00 am

if you’re using nginx webserver then use this post or otherwise use apache one

Reply
Tnow July 28, 2019 - 2:23 am

Web Servers: nginx-varnish-apache

What do you recommend I use, this post or the other one?

Reply
Tnow July 28, 2019 - 2:28 am

Can I do both? Will that be a problem or redundant and shouldn’t?

Reply

Leave a Comment