Hosting Tutorial & Guide

How to Set Up CloudFlare CDN for a WordPress Site

updated on Nov 16, 2016
How to Set Up CloudFlare CDN for a WordPress Site Currently, the number of activities to boost SEO rankings by the use of CDN (content delivery network) seems to be on the increase. In most cases, your website speed will be taken into consideration as an important criterion in search engines' ranking algorithms, and a content delivery network can display content to your readers/visitors responsively and efficiently.

Over the Internet, there are lots of premium and free CDN solutions, among which CloudFlare is deemed as the most excellent option to accelerate and protect a WordPress site. At this place, we are going to illustrate how to set up the CloudFlare content delivery network in WordPress with a good collection of useful tips included. Now, move forwards and access the rest of this tutorial.

What Is CDN & How Does It Work?

By definition, a content delivery/distribution network is a large system of computers which are placed at different locations to deliver all static contents to end-users with high performance and availability. Generally speaking, a CDN service can use many methods to deliver your website content, including:

Origin Pull – is where to deliver some small files stored on your web server, such as CSS, JavaScript, images, text, etc. This method requires storage on your web server, and it is recommended for WordPress files no more than 10MB.
Peer-to-peer CDN – is where to distribute an anecdote of movies, TV shows or some kinds of software patches to a large number of users within a short period of time. This peer-to-peer network allows your clients to provide resources on your server, and its serving capacity will increase as more and more users come to your content.
Pop Pull CDN – is where to upload your content to the CDN host server rather than your server. This kind of configuration is a little bit expensive as you will have to purchase the mentioned CDN storage and bandwidth from your hosting provider, and it is a perfect option for video streaming and large files.

Since most of us use shared hosting where all files are stored in a data center, we can take advantage of a CDN that locates data centers across the Internet to serve content to users from the nearest data center. And CloudFlare CDN is such a useful tool that optimizes delivery of your own web pages by distributing your content throughout the world. Here, we will give some simple and practical steps to setup CloudFlare CDN as below.

How to Setup CloudFlare - About CloudFlare

How to Setup CloudFlare in Your WordPress Site?

Before starting out, you'd better check your web host for any errors that may slow down your website. If this is the case, you will have to go with better WordPress hosting provider like BlueHost that has expertise and reputation in ensuring an ultra-fast hosting environment. More importantly, BlueHost is a CloudFlare-certified hosting partner that allows uesers to enable CloudFlare directly from cPanel, and it now gives a sale price of $2.95/mo through this promotional link.

BlueHost Promotional Link Activation

In some cases you might like to try CloudFlare CDN from its official site, you can use the following steps as a reference.

Step 1 – Register with CloudFlare

The first thing you need to do is visit CloudFlare and signup for a free account. As below, it is required to fill in your personal information, such as email address, username, password, etc. Beware that, the username should be your ID in emails or wikis, and the password will be at least 7 characters.

How to Setup CloudFlare - Register with CloudFlare

Make sure that you have read the "Terms of use" before you make a click on this "Create account now" button. Once completed, CloudFlare will send you a success email to confirm your account and give you some guidelines as well.

Step 2 – Login to CloudFlare Account

As is implied in the "pocket guide", you are required to visit this link to login to your CloudFlare account. Note that, your email address and password are required as is showed below. Of course, it is possible to keep yourself logged on your computer by checking the respective box.

How to Setup CloudFlare - Login to CloudFlare Account

Step 3 – Add a Website

And then, you will be prompted to fill in your website domain. If you have multiple websites, you can choose to add them afterwards. And there is no downtime in adding your website. Remember to click this "Add Website" button to proceed with the next step.

How to Setup CloudFlare - Add a Website

Step 4 – Scan Your DNS Records

Once done, CloudFlare will scan all of your domain's records, which will take about 60 seconds. During this scanning process, you will be presented with an informational video that reveals how CloudFlare works, along with related instructions. Once this DNS scan is completed, you should make a click on the "Continue" button to go on.

How to Setup CloudFlare - Scan Your DNS Records

After this scan, CloudFlare would display you with a detailed list of DNS records that include your subdomains. Till this step, you shall decide the subdomains that you wish to enable in CloudFlare by clicking this orange cloud icon, and in the meantime, choose the subdomains that you wish to bypass CloudFlare by clicking this grey cloud icon. By the way, you can ignore other records like MX and TXT directly.

How to Setup CloudFlare - Enable Your Records

It is highly recommendable to go with the defaults as above. If you are quite content with your DNS records, you can click this "I've added all missing records, continue" button to proceed.

Step 5 – Make Settings for Your Website

In the following screenshot, you would make a decision from three plans, including Free, Pro and Business. Note that, the "Free" plan includes a 24-hour gap in SSL encryption for website traffic. Besides that, you also need to make settings on "Performance" and "Security."

How to Setup CloudFlare - Settings to Your Website

Given that you choose the "Free" plan, you will be displayed with other recommended settings, including "Automatic IPv6" and "SmartErrors." If you are not sure what you are doing, you'd better use the default choices as above. Do not forget to click "Continue" button to move on.

Step 6 – Update Your Name Servers

Last but not the least, you should update your own name servers with your DNS provider. This process varies differently, and you can refer to this post to know how to change name servers with popular registrars. Pay attention that, there are two CloudFlare name servers that are distributed to the newly-added website.

How to Setup CloudFlare - Update Your Name Servers

In most circumstances, it will take around 48 hours for your domain registrar to update the name server. And CloudFlare will automatically email you once the name servers update is completely finished. If so, you will need to go back to the setup page of CloudFlare and make a hit on this "I've updated my name servers, continue" link to end your signup.

Till now, you have accomplished the signup process and successfully added a site to CloudFlare, but there are some top suggestions you need to know:
  1. Whitelist your CloudFlare's IP addresses. For data security and integrity, it is recommendable to whitelist CloudFlare's IP ranges with your web host.
  2. Bookmark your CloudFlare's Status Page. To be precise, CloudFlare runs up to 10 data centers on a global scale, and you'd better bookmark its status page to get to know the most current updates.
  3. Ensure that your DNS records are totally correct on the CloudFlare DNS settings page. In some cases you need to edit or add entries to DNS records, you can follow the root of "Your Websites" > "Settings" > "DNS Settings."
  4. Install mod_cloudflare or a WP plugin to get visitors' original IP addresses. As CloudFlare usually acts as a website proxy that won't show the original IP by default, you can choose to install this CloudFlare WP plugin to correct the IPs information.