Control Panel

Steps needed to Install mod_cloudflare on Apache Server

In this tutorial, we will see how to install mod_cloudflare on Apache server.

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.

This installation has been done on CentOS 7.

Let’s get started with the installation.

1. Keep the server up-to-date:

# yum update -y

2. Install additional required packages:

# yum install libtool git -y

3. Clone mod_cloudflare from github

# git clone

4. Install mod_cloudflare

First change working directory and move the mod_cloudflare directory

# cd mod_cloudflare

Now, install it using following command:

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

Note: you can use apxs2 command too.

That’s it, the installation is done.

5. To verify the installation run following command:

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

If you get output of cloudflare listed this means that the module has been installed.

In this article, we have seen how to install mod_cloudflare on Apache server.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles