How to Setup Cloudflare Free CDN in WordPress (Step by Step)

Do you want to use the free Cloudflare CDN on your WordPress site?

Cloudflare is one of the best WordPress CDN services available in the market. They offer a free CDN that speeds up your website along with a suite of powerful security features for small business websites.

The challenge is that many entry-level users are not able to use Cloudflare because they think it is hard to set up.

In this guide, we will walk you through a complete Cloudflare setup in WordPress to help you improve your website speed.

How to setup Cloudflare free CDN in WordPress (step by step)

Table of Contents:

What is a CDN? Why Do You Need a CDN for Your Site?

A CDN or Content Delivery Network is a system of distributed servers which helps deliver your website files faster to the users based on their geographic location.

Typically, a web hosting service serves your website visitors from a single location.

All the users access the same server, no matter where they are located. This can result in a delay in content delivery for users living further away from your website’s central hosting server.

CDNs solves this problem by setting up multiple edge servers in different locations around the globe.

These CDN servers cache static content from your site’s origin/central server, store, and present them to the users after they request for it.

Content Delivery Network (CDN)

When there is a user request, the CDN server closest from the user’s location will handle it.

For example, if someone in the USA wants to access a UK-hosted website, then a CDN server in the USA will serve that request, not the main sever in the UK.

With a CDN, all the user requests are handled by the nearest CDN servers. This mitigates the physical distance between the visitors and your website’s server.

As a result, this improves your website performance and speed for all users regardless of their geographic location.

A faster website also improves user experience and gives your website a slight boost in SEO rankings.

Using a CDN also reduces the load on your primary server and protects it from crashing during traffic spikes. If you want to learn more, see our guide on why you need a CDN for your WordPress blog.

What is Cloudflare CDN?

Cloudflare CDN

Cloudflare is one of the most popular free CDN providers available on the internet. It is a large network of globally distributed servers which automatically cache static content and deliver dynamic content swiftly.

On top of a CDN service, Cloudflare is also a cloud-based website firewall and a distributed proxy server. It monitors all incoming traffic to your website and blocks suspicious traffic even before it reaches your server.

They offer a free basic plan that’s suitable for small business websites and blogs. They also offer paid plans starting at $20 per month.

Cloudflare is an excellent choice for small businesses looking for a free CDN. However, if you want to fully utilize all of Cloudflare’s features, then you will need the Business plan which costs $200 per month.

Editor’s note: We do not use Cloudflare on joinsessions. Instead we use Sucuri as a website firewall and CDN. This firewall has the double benefit of improving speed and security.

Setting Up Cloudflare on Your WordPress Site

Setting up Cloudflare on a WordPress website is quite easy. There are two different methods:

  1. By using a single-click Cloudflare setup option in your host’s control panel
  2. By signing up manually on Cloudflare website

The first method is the easiest way to enable the Cloudflare CDN on your WordPress blog.

Some of the top WordPress hosting services like SiteGround have partnered with Cloudflare to offer an easy setup option through their control panel.

If your web host doesn’t offer a built-in Cloudflare setup option, then you can manually add the service on your site. We will show both of these methods in details below.

Method 1: Setting up Cloudflare CDN with One-Click Setup Option in cPanel

We mentioned earlier that some WordPress hosting providers, like SiteGround, offer an easy option to configure Cloudflare CDN in WordPress.

These web hosts provide a built-in Cloudflare integration app in your hosting cPanel to enable the service with just a few clicks.

This Cloudflare setup option works similarly with most hosting providers that have the integration. For your reference, we will show the setup process on SiteGround hosting.

Enabling Cloudflare CDN on SiteGround

If you are using SiteGround as your WordPress hosting company, then you can set up Cloudflare CDN on your site in just a few minutes.

To get started, login to your cPanel account and you will find the ‘Cloudflare’ option listed under the ‘Speed’ tab. For example, take a look at the screenshot below.

Cloudflare SiteGround Panel

To enable Cloudflare free CDN on your website, just click on the ‘Set Up’ button to continue.

Those using the older version of cPanel will find it in the ‘Site Improvement Tools’ section. After that, click on the ‘Cloudflare’ icon.

Cloudflare Option in SiteGround cPanel

After that, you will see a popup asking you to create a Cloudflare account or connect to your existing one.

Simply enter an email address and password, then click the ‘Create’ button.

Connect Cloudflare and SiteGround

Next, you will see a message indicating that the CDN activation is in progress.

Once it is complete, the Cloudflare CDN will be active on your WordPress site.

Method 2: Setting up Cloudflare CDN in WordPress Manually

If your web hosting doesn’t have a single click Cloudflare configuration option, then you can use this method. It can take a few more minutes, but it is also easy and user-friendly.

To begin, you need to visit Cloudflare website and click on the ‘Sign Up’ button.

Visit Cloudflare website

On the next page, you need to enter your email address and password to create a Cloudflare account. Simply enter the information required, and then click on the ‘Create Account’ button.

Create Cloudflare account

On the next screen, you’ll be asked to choose the type of Cloudflare plan you want.

For this tutorial, we’ll choose the standard Cloudflare plan. Then, click ‘Get Started’

Select standard Cloudflare

After that, you can choose a free or paid plan.

Scroll down to choose the free plan, and then click ‘Continue’.

Select Cloudflare free plan

After that, you need to enter your website’s URL.

Then, click the ‘Add Site’ button.

Add Site to Cloudflare

After that, Cloudflare will show you a list of all DNS records their systems found. This will include your subdomains as well.

The DNS records you want to be passed through Cloudflare will have orange cloud icon. The DNS records that will bypass Cloudflare will have a gray cloud icon.

You need to review the list to make sure that your primary domain is active on Cloudflare with an orange cloud icon.

Verify DNS Records to Set up Cloudflare

Once you verify your DNS records, click on the Continue option at the bottom.

On the next and the final step of your setup, Cloudflare will ask you to update your nameservers. You will be asked to change your name servers and point them to Cloudflare nameservers.

Change Cloudflare nameservers

Notice: Changing nameservers can take some time to propagate through all over the internet. During this time, your website may become inaccessible for some users.

You can change name servers from your domain registrar account like Domain.com.

Or, if you got a free domain from your web hosting provider like Bluehost, then you will have to change the name server by logging into your hosting account.

For the sake of this tutorial, we will be showing you how to change the name servers from the Bluehost control panel.

While the process is similar across hosting companies, you can always ask your hosting provider for detailed instructions for their control panel.

Once you are logged on to your Bluehost cPanel dashboard, go to ‘Domains’ section, and select your domain name. After that, click on the ‘Name Servers’ tab and ‘Edit’ option.

Edit nameservers in hosting cPanel

Next, you need to select ‘Custom’ and enter the nameservers provided by Cloudflare.

Then, click the ‘Save’ button.

Save new Cloudflare nameservers

After that, you need to go back to Cloudflare setup page, and click on ‘Done, check nameservers’ button to finish the setup.

It will now check your new nameservers automatically.

Check Cloudflare nameservers

That’s it! Now it will take a few minutes to update your domain nameservers and activate Cloudflare.

Once activated, you will see the success message on your Cloudflare dashboard.

Cloudflare success message

You can now customize your Cloudflare settings from this dashboard. We will show you the most critical settings in the next section.

Note: The above screenshots show the Bluehost control panel. Your nameserver settings may look different if you’re using a different hosting provider.

Configuring Most Important Cloudflare Settings

Your basic Cloudflare set up is complete, but there are a few essential settings you need to configure to keep your WordPress site secure.

1. Configure WordPress Specific Page Rules

By setting up page rules, you can customize how Cloudflare works on specific pages on your site. It is especially useful in securing critical pages like login page, wp-admin area, etc.

The Cloudflare free account allows you to set up three page-rules. If you want to add more page rules, then you need to pay $5 per month for five additional rules.

First, you need to click the ‘Rules’ option at the top navigation menu and then click the ‘Create Page Rule’ button.

Create page rule

After that, you can setup three different page rules.

Simply add the following settings below to secure your website.

a) Secure your WordPress login page

Page URL: example.com/wp-login.php*
Settings: Security Level – High

Secure WordPress login page

Then, click ‘Save and Deploy’

b) Exclude WordPress Dashboard from Cloudflare and Enable High Security

Page URL: example.com/wp-admin*
Settings: Security Level – High
Cache Level – Bypass
Disable Performance
Disable Apps

Exclude WordPress dashboard

Then, click ‘Save and Deploy’

c) Force HTTPS

Page URL: http://*example.com*
Setting: Always use HTTPS

Always use HTTPS rule

Then, click ‘Save and Deploy’

Note: Some users have reported issues with configuring force HTTPS with Cloudflare.

A great alternative is using the All in One SEO plugin. It’s the best SEO plugin for WordPress used by over 2 million sites.

First thing you need to do is activate and install the plugin. For more details, see our guide how to install a WordPress plugin.

After that, navigate to All in One SEO » General Settings and then enter your license key into the ‘License Key’ box and click ‘Connect’.

Enter AIOSEO license key

You can find your license key in your account profile on the All in One SEO website.

Next, navigate to All in One SEO » Redirects and then click the ‘Full Site Redirects’ menu navigation option.

Navigate to full site redirects

Scroll down the page until you find the ‘Canonical Settings’ toggle.

Then, click this toggle so it turns blue.

Turn canonical settings toggle

Next, turn on the ‘Redirect from HTTP to HTTPS’ toggle.

This will create a redirect from HTTP to HTTPs.

When you’re done, make sure to click the ‘Save Changes’ button at the bottom or top of the screen.

Force HTTP to HTTPS settings

2. Configure SSL Certificate Settings

Another important setting is the SSL certificate available in the ‘SSL/TSL’ menu at the top.

Set SSL certificate settings

Make sure to click the ‘Full’ radio button if you are already using SSL.

If you don’t have an SSL certificate, then see our guide on how to get a free SSL certificate for your website.

Once you’re done, Cloudflare will provide a coveted green padlock to signify that your website is secure.

Optimizing Cloudflare for WordPress Using a Plugin

Cloudflare offers a dedicated WordPress plugin for one-click WordPress-optimized settings.

The plugin lets you quickly set up Cloudflare on your WordPress site, add web application firewall (WAF) rulesets, automatically purge the cache, and more.

To get started, install and activate the Cloudflare plugin on your website. For more details, see our step by step guide on how to install a WordPress plugin.

Once done, you need to visit Settings » Cloudflare in your admin panel to configure the Cloudflare settings.

On the settings page, you will see a ‘Create Your Free Account’ button and sign-in option for existing accounts. Simply click the ‘Sign in here’ link.

Cloudflare plugin settings

On the next screen, you will need to enter your Cloudflare email and API key.

Click the ‘Get your API key from here’ link.

Click get API key

This will bring up a popup for your account area on the Cloudflare website.

Make sure you are on your ‘My Profile’ page and then click on the ‘API Tokens’ menu option.

After that, go to the ‘Global API Key’ section and click on the ‘View’ button.

Get global API key

This will open a popup and display your API key.

You need to copy the key.

Copy Cloudflare API Key

Next, come back to your WordPress dashboard and enter your email address and API key.

Then, click the ‘Save API Credentials’ button.

Save Cloudflare API Credentials in WordPress

After that, the Cloudflare settings will appear on your dashboard.

From here, you can apply a single-click WordPress optimization, purge cache, enable automatic cache, and more.

To optimize your WordPress site, click the ‘Apply’ button.

Apply to optimize WordPress

Next, click on the ‘Settings’ menu option.

Here you will find more site optimization settings.

Cloudflare for WordPress Settings

You can scroll down on this screen to find the ‘Security’ section.

To improve your security select ‘High’ from the drop-down list.

Change WordPress security level

We hope this article helped you to learn how to set up Cloudflare free CDN in WordPress. You may also want to see our ultimate WordPress security guide and our expert picks of the best virtual business phone number apps.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.