Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

[ 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.

share|improve this question
Do you need to Apache to block in realtime? – Alastair McCormack Oct 22 '12 at 19:50
Also, is there any other error printed before the one mentioned? – Alastair McCormack Oct 22 '12 at 19:55
No just the one error. CloudFlare does the blocking, but I try to identify crawlers through behavioral tracking. For instance if the user loads the background texture image, and downloads the css file associated with a page. I've noticed CloudFlare can't get all the bots and some bots come directly by IP, bypassing CloudFlare. So I have to identify them before they get a chunk of my content. – Adam Oct 22 '12 at 19:58
Also+, did you install the RPM? If so, please do rpm -ql mod_clodflare – Alastair McCormack Oct 22 '12 at 19:58
package mod_cloudflare is not installed – Adam Oct 22 '12 at 19:59
up vote 1 down vote accepted

Fetch the RPM for your platform from (32bit) and (64bit)

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

Edit /etc/httpd/conf/httpd.conf

LoadModule cloudflare_module /usr/lib64/apache2/
<IfModule mod_cloudflare.c>
    CloudFlareRemoteIPHeader CF-Connecting-IP

On 32bit change lib64 to lib

share|improve this answer
I'm awarding you the points for being the only person to respond with an answer and it might work for some people. I actually tried both of these and it did not resolve my issue. I instead worked around by checking for the CloudFlare Remote IP header and setting it as the remote IP in my code if it exists. Thanks, Fuzzyfelt. – Adam Oct 28 '12 at 2:51
@Adam that's very generous, thank you. – Alastair McCormack Oct 28 '12 at 8:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.