How to Setup and Configure CloudFlare in cPanel

Setting up Cloudflare in cPanel Guide

The CloudFlare plugin comes pre-installed on our Shared and Business hosting packages and can be accessed via the Software section in cPanel.

chrome 2017 01 13 09 12 20 826ef9cbf7

If you’re on a Cloud or Dedicated server, you’ll need to install the plugin using the steps below.

Note: You’ll need an account with Cloudflare to utilize this plugin.

Note: Install using a Secure Socket Shell client like Putty.

Using the root user, access the server via SSH

Issue the following while logged in via SSH

curl -s https://raw.githubusercontent.com/cloudflare/CloudFlare-CPanel/master/cloudflare.install.sh -k HOST_API_KEY -n ‘YOUR_COMPANY_NAME’

HOST_API_KEY will look similar to 56yt8x9s987dfy4324bnv ‘YOUR_COMPANY_NAME’ should be surrounded by single quotes like ‘Hostwinds’

This begins your installation of Cloudflare.  cPanel plugin files will begin first, then mod_cloudflare.  Depending on the server, load time will take between a few seconds and 5 minutes.  The process will be complete when you see, Cloudflare module installed successfully.

Cloudflare has now been added to your server.  The process needs to be repeated for additional servers.  Ignore if you have an automatic update script running.

When finished with the installation, you should see the message:
“Plugin installed ok, Cleaning up.”

How do I Configure Cloudflare?

The plugin gives you two options for how to use the service.

  1. CNAME Setup – The authoritative DNS will continue to point to the customer’s domain.  Subdomains will only be pointed to Cloudflare.  CNAME only allows protection at a subdomain level, for example, admin.example.com versus example.com.
  2. Full DNS Setup – You must make Cloudflare the authoritative DNS by pointing your domain’s name server to their name server.  By adding full DNS provisioning, you allow root domain and subdomain protection throughout the website.

Partners dictate if they wish to allow a Full DNS zone set up for clients and customers.  N.B CNAME setup cannot be disabled. Here are the various ways Cloudflare can be enabled.

  1. Default option – CNAME setup only
  2. CNAME and Full DNS setups

You can configure this by editing the config.js.  Find it here:

plaintext /usr/local/cpanel/base/frontend/paper_lantern/cloudflare/config.js

Then update this parameter:

plaintext “featureManagerIsFullZoneProvisioningEnabled”: false – Full DNS disabled (all customers will use CNAME) or featureManagerIsFullZoneProvisioningEnabled”: true

Tags: