How to Setup Cloudflare CDN in WordPress

Learn WordPress for Free

How to Setup Cloudflare CDN in WordPress

How to Setup Cloudflare CDN in WordPress

Do you know Cloudflare boost your blog performance and protect your website from attack? Cloudflare is one of the popular and best CDN that speed up your website performance and protect against attacks such as DDoS. In this guide you will learn how to setup free Cloudflare CDN in WordPress blog.

What is CDN?

CDN short of Content Delivery Network is the distributed network which helps your website files to delivery faster to the users in their location. CDN stand in between your web hosting provider and the website’s users as a proxy which came to existences in 1990s with the aim of providing fast loading website by delivering the content quickly through its distributed proxy in geographical location.

What is Cloudflare?

Cloudflare is the CDN established in 2009 that optimize your website performance, delivery content faster, provides internet security and DDoS mitigation. It is the free CDN provider with the large distributed server across the world.

Setting up Cloudflare CDN in WordPress blog

It is easy to setup Cloudflare CDN in your WordPress Website. Many WordPress hosting companies provides one-click Cloudflare apps in their cPanel that make easy to configure.

If your hosting companies do not have the option to setup Cloudflare then you can easily add your website to Cloudflare CDN manually following the steps below.

Time needed: 10 minutes.

Setup Cloudflare CDN in WordPress

  1. Sign Up to Cloudflare Account

  2. Add your Website and Choose Free Plan

  3. Configure DNS Record

  4. Change the Name servers

  5. Install Cloudflare Plugin for Optimization

  6. Optimize Website using Cloudflare CDN Plugin

1. Sign Up to Cloudflare Account

Follow the link to create an account on Cloudflare. It will take you to the Cloudflare homepage. Click on Sign Up at the top-right.

How to Setup Cloudflare CDN in WordPress

In Sign Up page enter your email address and password then click on Create Account button.

How to Setup Cloudflare CDN in WordPress

2. Add your Website and Choose Free Plan

On the next page, enter your website name and click on Add site button.

How to Setup Cloudflare CDN in WordPress

Now, you are in Cloudflare plans page where you can choose the free plan to optimize your blog for security and high performance. Select Free plan and click on Confirm plan button.

How to Setup Cloudflare CDN in WordPress

3. Configure DNS Record

Cloudflare will pull the DNS records from origin web server. You can see the Proxy status in orange color which mean the domain will pass through the Cloudflare. Make sure your domain name passes through the Cloudflare. You can turn it off or on click on the orange icon.

After configuring your domain name click on Continue button.


On the next page, you will be ask to choose the method of moving your domain name to Cloudflare. Choose default method clicking on Continue with default button.


4. Change the Name servers

Your domain is configured to Cloudflare and now you need to update the domain name server pointing to the Cloudflare.

Replace cloudflare nameserver

You need to update the name server provided by the Cloudflare in your domain registrar. Login to your domain registrar such as, name, namesilo, namecheap1&1IONOS, Bluehost.

In this guide we have shown you how to change the name servers in 1&1IONOS domain registrar.

If your domain registrar is not 1&1IONOS domain provider then you may want to see this guide to update domain name servers in different registrar.

Log in to your domain registrar using username and password. In 1&1nos control panel you will find the Gear icon under Actions. Click on Gear icon then Name Server.

How to setup cloudflare cdn in wordpress

It will take you to the page where you will find the option to change the name server. Click on Edit name server button.

How to setup cloudflare cdn in wordpress

You will see the name servers box where you have to add the Cloudflare name server. Cloudflare has provided you two name servers e.g. &

Copy the name server and paste in the name server 1 and 2 box. Click on Save button.

How to setup cloudflare cdn in wordpress

It will take some time to propagate. Once propagated you will be able to see your website live.

Now, you need to go back to the Cloudflare page and click on Done, check nameservers button.

How to setup cloudflare cdn in wordpress

You have successfully added your website in Cloudflare.

Note: It will take few hours to complete propagation, you will receive activation email once completes.

5. Install Cloudflare Plugin for Optimization

Cloudflare allow you to optimize your website using its official plugin. The plugin makes easy to optimize your blog in one click. It inclues many features such as Web application firewall (WAF) rulesets and purging cache.

Login to the WordPress dashboard then install and activate Cloudflare plugin clicking on Add New under Plugins. You can refer to this guide on how to install WordPress plugins.

install cloudflare plugin

After activation of Cloudflare plugin, go to Settings then Cloudflare where you have to click on sign in here link.

sign in here cloudflare

It will be asked to login in using your email address and API key. To find the API key you need to login to the Cloudflare website and Click on drop down of my account icon then click on My Profile.

cloudflare profile

It will take you to your Cloudflare profile where you have click on API tokens menu. You will find the Global API keys below click on the View button of Global API key.

Cloudflare api

For security purpose, you will be asked to enter the password again. Enter your Cloudflare Password and click on view button.

api key

Now, you will find your API key which needs to be copied and paste in the Cloudflare plugin setup page in WordPress dashboard.

copy api key

Go back to WordPress dashboard. Enter the Cloudflare login ID and paste the API key then click on Save API Credentials button.

save api credentials

You have successfully configured Cloudflare plugin in your WordPress site. Now, you can access and optimize your website from WordPress dashboard using Cloudflare plugin.

6. Optimize Website using Cloudflare CDN Plugin

Cloudflare Home

In Home, you will find one-click optimization features such as clearing cache and activating under attack mode.

Let see the work of each Cloudflare features to optimize your WordPress website.

cloudflare home page
1. Enable “I’m Under Attack” Mode

This feature helps your website to protect from the attack. It will mitigate your website against basic attack. You can activate it clicking on the Enable “I’m Under Attack” Mode button at the top right. Though for the huge attack in your website’s layer 7 such as traffic flood and TCP flood needs firewall to confront.

2. Optimize Cloudflare for WordPress

This feature will increase the WordPress security level, set browser cache expiration and auto minify JSS, CSS and HTML scripts which increase the page speed. Page speed is one of the important factor to rank higher in search engine such as Google.

3. Purge Cache

Purge Cache clears all the resources from Cloudflare CDN and pull the purged resources to validate from your origin web server. It is recommend when your updated post or page doesn’t appears in the website.

4. Automatic Cache Management

Enabling this feature will clear all the cache resources across Cloudflare data centers automatically when you update the contains in your Website. Enable only when necessary.

Cloudflare Settings

Cloudflare settings allow you enable high security features to your website. Some of the features such as image optimization and DDoS mitigation need upgraded plan which start from $20 per month. If your website is having huge traffic or under DDoS attack then you need to upgrade the plan to implement firewall.

In Cloudflare free plan you can use some features such as enabling automatic https rewrites which will help you to fix mixed content issue while changing http to https.

Cloudflare Analytics

Analytics allow you to see the number of unique visitors that comes to your website, bandwidth that consumed, requests that are made through Cloudflare and threats that are blocked by Cloudflare.

Cloudflare analytics

We hope this guide on how to setup Cloudflare CDN in WordPress is helpful. If you find this guide helpful,

Leave a Reply

Your email address will not be published. Required fields are marked *