[SOLVED] Issues installing mod_cloudflare on CentOS 7

I was re-installing mod_cloudflare on a CentOS 7 webserver when I ran across a very frustrating error.

While the CloudFlare package website at https://pkg.cloudflare.com/ claims that they have RPM binaries available for CentOS 7 (installable with sudo rpm -ivh http://pkg.cloudflare.com/cloudflare-release-latest.el7.rpm), installing from their binary generates an HTTPD error referencing the httpd.conf doirective that loads the module:

LoadModule cloudflare_module  /usr/lib64/httpd/modules/mod_cloudflare.so

Running journalctl -xe shows the following errors the following errors occurring when httpd is launched:

httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/cloudflare.conf: Cannot load modules/mod_cloudflare.so into server: /etc/httpd/modules/mod_cloudflare.so: undefined symbol: ap_log_rerror

The solution – turns out CloudFlare’s binaries aren’t made to work out of the box with CentOS 7. That’s annoying. The solution is to download the source and compile it yourself, which is super easy:

cd /tmp
wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
apxs -a -i -c mod_cloudflare.c

This will automatically compile mod_cloudflare and load it in your httpd.conf. Just make sure any configuration changes you need are registered in /etc/httpd/conf.d/cloudflare.conf!

One thought on “[SOLVED] Issues installing mod_cloudflare on CentOS 7

  1. Can confirm your solution of compiling the package worked, many thanks!  The apxs command wasn’t found at first but running this line first resolved that:

    yum install httpd-devel

Leave a Reply

Your email address will not be published. Required fields are marked *