Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install mod_cloudflare for easyapache 4

I am trying to install mod_cloudflare for Apache using easyapache 4 on cPanel Server. I am running CentOS 7.2.

I have installed mod_cloudflare for EasyApache4 following the instructions under Option 2 here. After running the installer it said "Done. Please restart EasyApache 4". I then went into WHM -> EasyApache 4 and tried to find the server module, but it is not to be found. I clicked the "run system update" button and tried again, to no avail. Is there an easyapache service that needs to be restarted via the command line?

I am not a hosting provider so I have not tried the Cloudflare plugin for CPanel.

* Edit 4/9/2019 * Changing accepted answer to EasyCo's, as the original solution no longer works.

like image 671
Kevin Roth Avatar asked Dec 15 '22 03:12

Kevin Roth


2 Answers

Figured I'd throw my solution into the mix using Centos 6.9 with WHM/cPanel.

bash <(curl -s https://raw.githubusercontent.com/cloudflare/mod_cloudflare/master/EasyApache/installer.sh)
wget https://raw.githubusercontent.com/cloudflare/mod_cloudflare/master/mod_cloudflare.c
yum install ea-apache24-devel
apxs -a -i -c mod_cloudflare.c
rm /etc/apache2/conf.modules.d/mod_cloudflare.conf
service httpd restart

What's happening?

  1. We're using the cPanel installer.sh as suggested by Cloudflare but the compiled mod_cloudflare.so throws an error if you then run service httpd restart. Lets fix this.
  2. Download the source mod_cloudflare file.
  3. Ensure we have the correct EasyApache4 developer tools to build the mod_cloudflare module.
  4. Build and install extension module.
  5. Remove the new mod_cloudfare.conf file since we prefer the one that was generated and installed in step 1.
  6. Restart apache.

Note: The mod_cloudflare module will not show in EasyApache4. You can see it's enabled by running httpd -M | grep cloudflare and you should see something like cloudflare_module (shared).

References:

  • https://www.cloudflare.com/technical-resources/
  • https://community.cloudflare.com/t/help-installing-mod-cloudflare/1747/12
  • http://www.marathon-studios.com/blog/issues-installing-mod_cloudflare-on-centos-7/
  • https://forums.cpanel.net/threads/install-httpd-devel.594631/#post-2405975
like image 60
EasyCo Avatar answered Jan 09 '23 01:01

EasyCo


I found a solution that worked perfectly.

This github project installs the module and adds it into EasyApache so that future rebuilds keep the module active. This was the only solution I found that actually works for EasyApache 4. Everything else seems to be for EasyApache 3.

CloudFlare was not much help with this either, as they had suggested I contact my hosting provider for assistance.

like image 20
Kevin Roth Avatar answered Jan 09 '23 02:01

Kevin Roth