Last Updated on 18th February 2021 by Editorial Team (Victoria)
Do you want to set up cloudflare CDN on your wordpress site?
Cloudflare is one of the best free content delivery network and security services available in the market.
They offer a free CDN service that enhances the speed of your site alongside a security service that ensures your site is secured from bot and third party attacks.
Often, beginners are of the opinion that setting up cloudflare on wordpress is extremely difficult.
In this guide, you will learn how to set up cloudflare in wordpress and lot more.
What is CDN and its importance?
CDN is an acronym that stands for Content Delivery Network, made up of a network of servers, it enhances the effective distribution of website files, content to users based on their geographic location.
It solves the problem of user accessing website files or content on the same server, while these could cause a delay in website page load speed,
In addition, CDN provides a network of servers in different geographic location across the globe, where users can access content.
Whenever a user makes a request, the CDN server closer to the user’s location responds to the request.
For example, if a Nigerian wants to access an Indian hosted site, a CDN server in Nigeria will handle the request, not the main server in India.
CDN allows request to be handled by the nearest servers, hence speed is efficient because while the server can be loaded due to the facat that all users request are connected to it, CDN prevents that by offering multiple network servers.
Want to learn more about CDN’s, read our article on what is CDN and it’s use.
What is cloudflare CDN and its benefits to your wordpress site?
Cloudflare is one of the best and popular CDN services on the internet.
Apart from the CDN services for best speed delivery it offers, it also offers security services to help prevent bots and third party attacks.
They offer a free basic plan for blogs and small business, but to unlock more cloudflare features, you can subscribe to their business plan. It costs $200/month.
Benefits of using cloudflare on your wordpress site
The cloudflare CDN services provides you with lots of benefits which include:
- A faster page load time: This is because cloudflare caches your content across a network of servers, based on users location, you tend to enjoy speed benefit using cloudflare CDN.
- A decrease in bandwith usage: Similarly, as cloudflare enhances the speed of your site, it also decreases bandwith usage via its caching features.
- Traffic: Cloudflare helps to sort out bot traffic and other negative traffic from third parties.
- Enhanced security: Conclusively, cloudflare offers a firewall, DDos protection, and free SSL to enhance security on your wordpress site
How to setup Cloudflare in WordPress
Installing and setting up cloudflare on wordpress is easy, kindly follow the guide we have provided below:
To begin, you need to first,
1. Create a Cloudflare account:
Visit the cloudflare website on cloudflare.com, Click on the ‘Sign up’ botton to create an account.
On the next page, provide your email address and password, after which you click on the ‘Create account’ button
2. Add your domain name to Cloudflare
The second step on how to setup cloudflare in wordpress is to Click on +Add Site and write down your site name (like findmytricks.com).
Do not use other things like https or www.
You will see, we are querying your DNS Records. Click next.
3. Select a plan.
If its a small business or personal blog we recommend that you continue with the free plan.
However, you can choose whatever plan suits your needs.
but in this guide, we choose the free plan.
4. Check the DNS query results for your website.
Once you have added your wordpress site to cloudflare, you will receive a notification indicating that you enable or disable cloudflare for subdomains.
Click or tick all status(till www).
What you need to verify is that an orange is displayed on your primary domain, Now click on continue button to proceed to the next step.
4. point your domain name to cloudflare nameservers
The fourth step is to replace your previous nameservers with cloudflare.
To do this, simply open a new tab and navigate to your hosting panel, Replace your previous name server with cloudflare and click on ‘update’.
Return to the clouflare page and click on the ‘done, check nameservers‘ button.
For example, if you are using Godaddy then :
- My products
- Name servers (change). It will take around 24 hours as they say, but it generally takes only a few minutes.
If you will see the status: Website not active (DNS modification pending), then click on recheck nameservers. After that, you will see the status active.
Most of the things are not important, so I will tell you about important things only.
As you are just signed up, you will see your results after some time.
You will see your analytics after sometimes.
Change your DNS settings here if you don’t change it at the start.
If you have an SSL certificate then enable full or full strict mode otherwise go for flexible.
This will show you your SSL certificate, if active.
Enable always to use https.
Change HSTS settings,
max-age – 12 months
include subdomains – on
preload – on
Enable onion routing, TLS 1.3 and Automatic https rewrites.
If you don’t have an SSL certificate then here you can create your free TLS certificate signed by Cloudflare on your origin server.
– Enable accelerated mobile links
– Enable Brotli
– Enable Rocket loader
Caching – Standard
Browser cache expiration – Make it default or you can change according to your need.
Always online – Make sure it is on.
The page rule setup allows you to customize how you want cloudflare to work on some of your specific pages.
Cloudflare is quite useful in securing the most important pages on your wordpress site like the WPadmin area, login page, etc.
The Cloudflare account is limited to three page rules.
However, if you are interested in adding new page rules, you will be charged $5 on a monthly basis.
This package unlocks 5 more additional rules.
However, in this guide, we will be using the free plan.
From the image below, you can see that i have already created my page rules, but not to worry, i will walk you through the process of setting yours up.
To set up page rules:
First, navigate to the page rules option at the top of your cloudflare homepage.
Click on the ‘create page rule’ button
Page rule 1
Click on create page rule.
Enter your website name,
Okay, let me show you with the example of my website.
findmytricks.com/* (for those who don’t have SSL certificate)
HTTP://*findmytricks.com/* (for SSL certificate users)
Add a setting (click)
Browser cache TTL – a day
Cache Level – cache everything
Page Rule 2
Create new page rule (for home page)
Enter your website name
https://*findmytricks.com/wp.admin* (for SSL certificate users)
findmytricks.com/wp.admin* (for non-SSL certificate users)
Add a setting
Browser integrity check – ON
(With this Cloudflare will stop blacklisted IP address or websites to visit your websites and make harm.)
Always online – Off
Security level – High
Browser Cache TTL – 30 minutes
Disable apps – apps are disabled
Disable performance – performance is disabled
Page Rule 3
Create a new page rule
enter https://*findmytricks.com/*preview=true* (for SSL Certificate users)
findmytricks.com/*preview=true* (for non SSL certificate users)
Add a setting
Browser Integrity check – On
Always online – Off
Security level – High
Browser cache TTL – 30 minutes
Cache level – Bypass
Disable apps – Apps are disabled
Disable performance – Performance is disabled
These 3-page rules are recommended by Cloudflare, so if you can’t understand anything then just copy these rules.
Note: Changing your domain nameservers can take a few days to propagate the internet. during this period, your page may or may not face any downtime issue.
To check if the nameservers update has been completed, you will receive a confirmation email from cloudflare, on the other hand, you can check your status update on the cloudlare website consecutively.
How to setup cloudflare plugin in WordPress
Another way to setup cloudflare on WordPress is to use the cloudflare plugin
If you have consulted the previous method, then there is no need to tune in to this
However, if you prefer to use this method, kindly follow the guide below
1. Visit the plugin section on your WordPress dashboard
2. Click on “Add new”
3. Type “Cloudflare” into the search query
4. Click on ‘install’
5. Click on ‘Activate’
Once you have activated the plugin, go to the settings>cloudflare on your WordPress dashboard
Click the link to sign In.
On the next page you will need to type in your email address and API key.
To get your cloudflare API key, visit your ‘account area’ on the cloudflare website.
Simply navigate to “My Profile’ page, open and click on the API tokens as displayed below
After that, navigate to the global API key sections
Click on the ” View” button to get your API key.
Your API key will be displayed as a popup message.
Copy the key.
Return to your WordPress dashboard to enter your email address and API key.
Click on the “Save API credentials”
Finally, you will need to optimize cloudflare for WordPress and this is done with just a single-click.
This one-click solution allows you to implement all the cloudflare settings needed for speed and security
In conclusion, i hope you have learned how to setup cloudflare on your wordpress site.
Remember that the main goal of the cloudflare CDN is to enhance the effective distribution of website files to avoid delay or lagging of your site, if the content is served on a single server.
Setting up cloudflare on your wordpress site is an easy task to as long as you follow the guidelines i have provided above.
In case you encounter any difficulty during the setup, i will be at the comment section waiting for you.
People also search for :
Ajmer Singh is the Founder & Author of Findmytricks. He is a Passionate Blogger, Content writer & WordPress designer. He loves sharing content regarding WordPress and Blogging. He enjoys playing games in his free time.
1. “Be yourself. Everyone else is already taken.”
2. “First, learn the rules, then break them”