Friday, 30 March 2012

Install cloudfare module and plugin on cpanel

Install mod_cloudflare on cpanel

Step 1. Connect to your server through SSH and log in as root.

root@server [~]# ssh root@SERVER IP ADDRESS or SERVER NAME

Step 2. Change directory to /usr/local/src:

root@server [~]# cd /usr/local/src

Step 3. Get the source code for mod_cloudflare:

root@server [/usr/local/src]# wget --no-check-certificate http://github.com/cloudflare/CloudFlare-Tools/raw/master/mod_cloudflare.c

Step 4. Use the Apache Extension Tool to build and install mod_cloudflare:

root@server [/usr/local/src]# apxs -a -i -c mod_cloudflare.c

Step 5. Restart the Apache HTTP daemon:

root@server [/usr/local/src]# service httpd restart

Step 6. Finally, update the Apache configuration data files:

root@server [/usr/local/src]# /usr/local/cpanel/bin/apache_conf_distiller --update


Install CloudFlare plugin for CPanel.

Step 1.

root@server [/usr/local/src]# curl https://www.cloudflare.com/downloads/cloudflare.tar.gz > cloudflare.tar.gz

Step 2. Extract cloudflare.tar.gz

root@server [/usr/local/src]# tar -zxf cloudflare.tar.gz
This extracts a directory that includes a UNIQUE ID. For example, the directory will be in this format:
cloudflare-CloudFlare-CPanel-40cf7b2
The UNIQUE ID is only: 40cf7b2
The UNIQUE ID is not cloudflare-CloudFlare-CPanel-40cf7b2

Step 3.

root@server [/usr/local/src]# cd cloudflare-CloudFlare-CPanel-UNIQUE ID/cloudflare/

Step 4.

root@server [/usr/local/src/cloudflare-CloudFlare-CPanel-UNIQUE ID/cloudflare]# ./install_cf API HOST KEY mod_cf “YOUR COMPANY NAME”
example for Great Hosting Company: ./install_cf 56yt8x9s987dfy4324bnv mod_cf “Great Hosting”

Step 5. After the installation, you will see this:

CloudFlare module installed successfully

Step 6. To check if it is installed:

root@server [/usr/local/src/cloudflare-CloudFlare-CPanel-UNIQUE ID/cloudflare]# cat /usr/local/cpanel/etc/cloudflare.json
You should see an output with the following:

root@server [/usr/local/src/cloudflare-CloudFlare-CPanel-UNIQUE ID/cloudflare]# cat /usr/local/cpanel/etc/cloudflare.json
{
 “host_key”:”32yt5a7b436tuy8974tre -”, (For security purposes, this will not be your host key.)
 “host_formal_name”:”Awesome Hosting”,
 “host_name”:”api.cloudflare.com”,
 “host_uri”:”/host-­gw.html”,
 “user_name”:”www.cloudflare.com”,
 “user_uri”:”/api_json.html”,
 “host_port”:”443”,
 “host_prefix”:”cloudflare-­resolve-­to”,
 “cp_version”:”1.3.0”
}

Step 7.

root@server [/usr/local/src/cloudflare-CloudFlare-CPanel-UNIQUE ID/cloudflare]# cd ../../

Step 8. Remove cloudflare-CloudFlare-CPanel-UNIQUE ID*

root@server [/usr/local/src]# rm -rf cloudflare-CloudFlare-CPanel-UNIQUE ID*

4 comments: