Here you’ll find an installer script that adds
mod_cloudflare to your EasyApache build system included with cPanel servers. The CloudFlare module automatically translates visitor IP addresses to reflect the visitor’s original IP address rather than the IP address of the CloudFlare proxy servers.
Short Version For The Impatient
You can install
mod_cloudflare on your cPanel server by running the following command:
perl <(GET https://raw.github.com/tylerl/util/master/easyapache/cloudflare.pl) install # or if that doesn't work... wget https://raw.github.com/tylerl/util/master/easyapache/cloudflare.pl perl cloudflare.pl install
Then run EasyApache installer, and check the box marked “Mod CloudFlare”. Hit Save and Build and you’re done.
Why do I need this?
The EasyApache build utility included with cPanel can greatly simplify managing your server installation, but also makes it tricky to install modules that aren’t bundled with the utility. You can build and install them manually using the the standard
apxs method, but if you do so you may find yourself in a mess next time you upgrade your PHP/Apache installation. Since EasyApache starts out with a fresh, clean source tree for every build, you’ll find that your module is no longer included and your websites may end up broken.
So if you’re installing a custom module for Apache, your best bet is to do so though the EasyApache build system, which ensures that your changes will persist through future upgrades.
How does it work
When you run the installer script, it downloads the latest version of the
mod_cloudflare.c source code from the official distribution point and packages it up with a simple description file that tells EasyApache what to do with it. Then you have two options: you can either save the resulting package to upload to a server elsewhere, or, if you’re running this on the server itself, you can simply install it directly through the script.
To run the install script on your server, download this script here: https://raw.github.com/tylerl/util/master/easyapache/cloudflare.pl
Then run it using the following command:
perl cloudflare.pl install
Once you’ve installed the EasyApache component, re-run the EasyApache build script, either through the WHM web interface or by running
/scripts/easyapache to complete the installation. Select “Mod CloudFlare” from the build menu to enable the Apache module, or deselect it to disable the module, and then run your build. It’s pretty simple.
Alternately, you can build a package using this command:
perl cloudflare.pl build
You can check out the official documentation from cpanel to see what to do with the package that gets built. If all you’re looking for is the pre-built package, then grab the file here: https://raw.github.com/tylerl/util/master/easyapache/bin/custom_opt_mod-mod_cloudflare.tar.gz