If you’re like most web developers, speed and security are the most important aspects that a WordPress website needs. Along with other known techniques such as using optimized images and a cache plugin, using CloudFlare CDN (content delivery network) is a highly recommended approach to increase your website’s load speed as well as search engine rankings.
In this tutorial, we shall show you how to setup Cloudflare CDN for your WordPress on a hosting dashboard or Cloudflare account, but before that let’s look at the basics.
CloudFlare CDN: What is it?
CloudFlare is a distributed proxy server and a content delivery network (CDN) that caches some of the most well-known web content and delivers it to users across the world. This leads to a number of benefits like increased page load speed, clean traffic, increased security and reduced bandwidth usage.
Cloudflare CDN also provides other options such as DDos security, optimization of ads, analytics, and much more.
Before you start the setup, make sure you have the following:
- Access to the control panel of your domain name registrar.
- Access to WordPress admin area
Let’s go through each step in detail.
Option 1: Installing CloudFlare on Your Hosting Dashboard
Some web hosting providers like Bluehost or HostGator offer an easier Cloudflare installation directly from cPanel. To find out if your hosting company provides direct installation of CloudFlare, log in to your cPanel homepage, and look for the CloudFlare logo on the advanced settings.
Next, register a Cloudflare account. To do so, follow the following steps.
- Go to cloudflare.com and in the sign-up box, type your email and a password then press the sign up button.
- On the registration page, enter all the required details.
- Then press the Create Account button. You don't have to proceed to the next step to scan DNS records since it’s taken care of by the web host.
- Now, return to your web host cPanel. Enter a username and password you used before to log in to your Cloudflare account.
- After this step, you will be directed to the settings page on your Cloudflare account. Press the Activate link near the domain turn on Cloudflare.
Cloudflare free tier isn’t compatible with SSL certificate that is offered by web hosting companies. So if you decide to use SSL on your website, you will need to choose a paid Cloudflare plan. For those who don’t require the full-service security that comes with paid SSL certificates, they can opt for the free Cloudflare plan with SSL option.
Once Cloudflare is enabled, your web host will take care of the remaining details, and you will access Cloudflare settings from your cPanel dashboard.
Now you have successfully installed Cloudflare on your hosting cPanel dashboard.
Option 2: Adding CloudFlare to Your WordPress Site
Before you include CloudFlare on your website to improve speed, make sure you have a good hosting provider with no downtime. Then, if your web hosting company doesn’t offer an option to setup CloudFlare account through your cPanel, you can do it yourself using the steps below:
Step 1: Creating your CloudFlare Account
To setup CloudFlare, the first step is to signup for an account. Go to the official CloudFlare website and click the Sign Up button.
If you already have an account, you can skip this step.
Step 2: Adding your Website To CloudFlare
After you have signed up for an account, you will be required to add your website. To do so, just type or paste your domain name into the text box and click Scan DNS Records button.
At this point, it’s important to ensure that CloudFlare is enabled for your naked domain name and www domain. This allows CloudFlare to work on both of these domain versions. Once you’re done, click Continue button.
Step 4: Choosing a Plan
Cloudflare will now take you to their paid plans page. For this example, you can select the Free Website option then click Continue.
You may upgrade later to enjoy advanced features.
Step 5: Pointing Your Website to CloudFlare Nameservers
At this point, you will be presented with CloudFlare nameservers. You will be prompted to switch the nameservers to CloudFlare. To do so, go to the domain’s control panel and update the nameservers to the CloudFlare nameservers.
If you’re not sure how to go about changing your nameservers, it’s recommended that you consult your domain registrar's support to guide you through the process.
Once more, click Continue.
You may need to wait for some hours for the nameserver to propagate worldwide.
Once the update is complete, you will receive a confirmation email message from CloudFlare. Your Cloudflare dashboard should look like this:
Step 6: Configuring CloudFlare on WordPress
For WordPress websites, Cloudflare offers unique features such as:
- One-click optimization settings
- Specific rulesets for the web application firewall
- Automatic cache purge
- Ability to adjust settings on Cloudflare without opening its the Cloudflare dashboard.
To active CloudFlare plugin on WordPress, go to the Plugins section and press the Installed Plugins button. Look for CloudFlare plugin and press the Settings button.
A screen will pop-up prompting you to enter your email address and API key:
To find the Cloudflare API key, login to the Cloudflare interface, and click on your email address. Choose My Profile, then scroll down until you see the API Key section. Press the View API Key.
Once you have the API Key, enter it into the API Key box plus your email in your
WordPress dashboard. Now, press the SAVE API Credentials button to save these changes.
When you transfer it to the CloudFlare settings interface, press the Apply button below the Apply Default Settings section.
Remember to enable Automatic Cache on WordPress by pressing the Apply button in the Automatic Cache section.
That’s it! By now you should know how to go about activating CloudFlare for your site and configuring CloudFlare plugin on WordPress. This will ensure your sites loads faster and secures it from DDoS attacks.