apxs cannot install mod_cloudflare on centos

by Adam   Last Updated July 04, 2018 19:00 PM

[ Linux - CentOS - Apache 2.2 - mod_cloudflare - apxs2 ]

I have changed my nameservers to point to CloudFlare. The problem is that all the IP addresses are coming in as CloudFlare's. This is no good, because I have to monitor and block some specific traffic. mod_cloudflare is supposed to resolve this but I have been unable to get this installed. The command in the documentation uses apxs2. I can't figure out how to install this, or if it just means for 'apache 2.4'. I'm running 2.2.3, and I can use 'apxs'.

When I run:

apxs -aic mod_cloudflare.c

I get the error

apxs:Error: Command failed with rc=65536

Does this mean I need apxs2 or something else? How do I get mod_cloudflare working on my server?

I appreciate any help, the documentation is vague and limited.



Answers 2


Fetch the RPM for your platform from https://www.cloudflare.com/resources-downloads: https://github.com/downloads/cloudflare/mod_cloudflare/mod_cloudflare-1.1.1-1.i586.rpm (32bit) and https://github.com/downloads/cloudflare/mod_cloudflare/mod_cloudflare-1.1.1-1.x86_64.rpm (64bit)

Install: rpm -ivh mod_cloudflare-1.1.1-1.*

Edit /etc/httpd/conf/httpd.conf

LoadModule cloudflare_module /usr/lib64/apache2/mod_cloudflare.so
<IfModule mod_cloudflare.c>
    CloudFlareRemoteIPHeader CF-Connecting-IP
    CloudFlareRemoteIPTrustedProxy 204.93.240.0/24 204.93.177.0/24 199.27.128.0/21 173.245.48.0/20 103.22.200.0/22 141.101.64.0/18 108.162.192.0/18
    #DenyAllButCloudFlare
</IfModule>

On 32bit change lib64 to lib

Alastair McCormack
Alastair McCormack
October 22, 2012 20:17 PM

A bit late to the party, but I received the error:

libtool: install: cp .libs/mod_cloudflare.so /usr/lib64/httpd/modules/mod_cloudflare.so
cp: cannot create regular file '/usr/lib64/httpd/modules/mod_cloudflare.so': Permission denied
apxs:Error: Command failed with rc=65536

And the reason, as stated in the error, is due to Permission denied.

I was able to execute the command with sudo:

sudo apxs -a -i -c mod_cloudflare.c
Lucas Basquerotto
Lucas Basquerotto
July 04, 2018 18:01 PM

Related Questions


Cloudflare Proxy Slow HTTP Download Speed

Updated February 19, 2018 18:00 PM


How to setup rDNS on centos 7

Updated September 02, 2017 10:00 AM