October 18, 2022
Complete guide to using WordPress with a CDN (content delivery network)

Like every website owner, you’ve surely heard the term CDN being used. If not, then maybe a brand name such as Cloudflare sounds more familiar. In this article, we’ll explain why you should be using a WordPress CDN. We’ll cover the benefits of CDNs for WordPress. We’ll also review the best CDNs for WordPress below.

What is a WordPress CDN?

You may be wondering about WordPress CDNs. In short, there’s no such thing as a WordPress CDN. That’s because CDNs aren’t built for specific content management systems. Instead, they are intended for use with a wide range of website types.

So, what is a CDN and how does it work? Let’s take a look.

What is a content delivery network (CDN)?

A content delivery network, or CDN, is a network of servers that are distributed worldwide to improve the loading speed of your website or online service. It achieves this by reducing the distance between servers and visitors.

Sounds promising, right? It is, and that’s why most of today's internet traffic is being served by CDN networks. That includes Netflix and Amazon, for example.

How a CDN works in WordPress

Using a CDN with your WordPress website is not much different than using it with another website type. There is one added benefit, however, and that’s the ability to set it up automatically with plugins. This can save the average user a lot of time and effort, especially if they lack website development skills.

Next up, we’re going to explore all the benefits of using a CDN and show you how to install it.

Benefits of using a CDN with WordPress

There are many benefits to using a CDN with your WordPress website, and it’s not all about speed improvements either.

Below we give you the six most important benefits and then dig deeper into each one.

  • Reduce bandwidth usage and costs
  • Improved traffic spike handling
  • Decrease your site’s loading time
  • Improved website security
  • More uptime
  • Better rankings for SEO

Reduce bandwidth usage and costs

The CDN does most of the heavy lifting by serving your website’s largest files, such as images and videos. That’s why you can expect a significant reduction in your hosting bandwidth usage and costs.

Even better, CDN networks charge a very affordable flat fee and often come with unlimited bandwidth. So you no longer need to worry about reaching your hosting bandwidth limits and having to pay additional fees.

Improved traffic spike handling

Every now and then, our websites experience an increase in traffic, leading to a spike in resource usage. This can cause your server to slow down and sometimes even freeze.

Since no one likes downtime, especially if they just paid for an advertising campaign, spikes can be a major hassle. CDNs do a good job of tackling this issue by reducing your origin server’s resource usage and preventing DDoS attacks.

Decrease your site’s loading time

We hear it all the time — people expect your website to load almost instantly. So you can’t afford to make them wait for more than a second or so. That’s why speed improvement is the number one benefit of CDNs.

But how do CDNs improve speed exactly? In three ways.

First, by using globally distributed servers to reduce the distance between your website and its visitors. Then, by applying the latest file compression to your data to reduce its size. And finally, by equipping their data centers with high-end technology such as SSDs and load balancers.

Improved website security

This is where CDNs come in handy with their DDoS protection and programmable rules for your WordPress login page, xmlrpc vulnerabilities, and more.

Another important security benefit is that a CDN will hide your origin server’s IP address. That makes your website harder to target and less vulnerable to attack attempts.

More uptime

Thanks to the CDN’s security measures and the offloading effect on your origin server’s resources, you can also expect better website uptime.

Better rankings for SEO

Believe it or not, even your website SEO can benefit from using a CDN. And not just for the obvious reason of speeding up your website to keep organic visitors engaged. It’s also an official ranking factor used by Google to serve the best search results.

Hearing about all these CDN benefits is pretty convincing, right? Great, then read on to see our speed test, and to learn how to set up a CDN for yourself.

WordPress speed tests: with and without a CDN

Now it’s time to take the Cloudflare CDN for a test drive. To do that, we created a simple dummy WordPress website using a popular theme and builder. After that, we used the GTMetrix site performance tool and took screenshots of the state before and after the CDN was implemented.

Below are the results our site got before implementing the Cloudflare CDN.

Speed test results before adding the Cloudflare CDN

Next up, we have the results the site got after implementing the Cloudflare CDN.

Speed test results after adding Cloudflare CDN

As you can see, when we compare the site before and after CDN implementation, it’s clear who the winner is. This test clearly demonstrates the importance and significance of using CDN services with your website.

How to install a CDN in WordPress

There are three basic steps to installing and setting up a CDN with your WordPress website: picking a CDN provider, installing a CDN plugin, and then putting it all together. Oh, and don’t forget to test everything once you’re finished.

Step 1: Pick a CDN provider and sign up

First things first, you need to pick a CDN provider and then register an account with them and buy a subscription. Since there’s great variety in the CDN market today, deciding on a CDN provider is not that easy. That’s why we decided to make it simple and list the four best WordPress CDN providers below.

Cloudflare: The most popular CDN solution with data centers across 100+ countries. What’s even better is that it offers a free plan that includes SSL and DDoS protection for an unlimited number of websites.

Sucuri: This CDN provider takes performance seriously and claims to increase your website speed up to 70%. It comes with extensive security features, and the pricing for the cheapest plan starts from $9.99/month per website.

StackPath: If your website is heavy in video and audio content, StackPath CDN is your best choice. It supports large file delivery, 4K videos, and segmented file downloading. The pricing starts as low as $10 for 1 TB of bandwidth, and SSL and DDoS protection are included.

KeyCDN: With over 40 data centers in 30 countries and DDoS protection, KeyCDN is another great solution. Its pricing starts from $4/month and increases based on bandwidth at a rate of $0.01-0.1 depending on volume and location.

Step 2: Install a CDN plugin

Now that you have a CDN service, it’s time to prepare your WordPress website for it by installing a CDN plugin. Just go to the WordPress plugin store, search for “CDN,” and then install one of them.

CDN plugins

As you can see from the image above, there’s no lack of options here either, so we list the five most popular choices below.

  • Jetpack: Over 5 million active installations and a 4 stars rating in the plugin store
  • WP Super Cache: Over 2 million active installations and a 4.5 stars rating in the plugin store
  • WP Fastest Cache: Over 1 million active installations and a 5 stars rating in the plugin store
  • W3 Total Cache: Over 1 million active installations and a 4.5 stars rating in the plugin store
  • EWWW Image Optimizer: Over 1 million active installations and a 4.5 stars rating in the plugin store

Step 3: Connect your website with the CDN

Alright, now that you have a CDN service and plugin, it’s time to connect your WordPress website with the CDN. This process can be different depending on your CDN provider, but it usually consists of retrieving a link from them and then putting that link into the plugin’s settings.

To learn more about this step, see our Cloudflare CDN configuration guide below.

Use WordPress hosting with a built-in CDN

Want to keep it simple and avoid having to configure all of this manually? Don’t worry, some hosting companies provide an integrated one-click CDN feature.

Here at Nexcess, we take care of the CDN configuration for you so you can spend more time focusing on what matters most. Learn more about our Nexcess Edge CDN — now powered by Cloudflare.

Integrating WordPress with Cloudflare

First, you need to create a Cloudflare account and add your domain to it. Once the domain is added, you will be asked to review and confirm your DNS records and click continue. You will then need to update your NS (nameserver) records at your domain registrar by replacing them with the ones Cloudflare provides on the next page. It might take a little while for this change to take effect.

Cloudflare CDN

Optionally,  you can now install a CDN plugin using the plugin store. In this example, we will use the official Cloudflare plugin to make this as simple as possible. To configure it, go to Settings on your WordPress website, and click on Cloudflare.

Now enter your Cloudflare account’s email address and the Global API Key and click on Save API Credentials. Once you’re in, the option to Optimize Cloudflare for WordPress will show up. Just click the Apply button to set everything up automatically.

And as a final step, you need to test if everything works properly. While there are plenty of ways to check if a CDN is enabled and working properly, we will show you the simplest one. There’s a tool called CDN Finder on the CDN Planet website. You can use it by clicking here, typing in your website’s domain name, and then clicking on Run CDN Finder. As you can see in the image below, Amazon is using the Fastly CDN.

CDN finder

Note: For more detailed instructions on how to set all of this up, see the official Cloudflare video instructions.

WordPress CDN without a plugin

At this point you may wonder, do I need a plugin? Don’t worry, using a plugin is completely optional, and the CDN works out-of-the-box. It basically allows you to manage some features without having to go to the official Cloudflare website. That includes clearing cache, SSL options, and more.

Use a CDN for better WordPress performance

If there’s just one thing we want to stress, it’s that everyone should consider using a CDN with their WordPress website. As you can see from reading this article, the benefits are outstanding. From increased page speed to a wide range of security improvements, it’s clear that no one should miss out on this technology.

Are you a WordPress user? Would you like to experience the best managed WordPress hosting? Then switch to Nexcess for the smoothest support experience and the fastest page load times.

Our managed WordPress plans come with the Nexcess Edge CDN powered by Cloudflare, so your site will be lightning fast.

Check out our fully managed WordPress hosting plans to get started today.

This blog was originally published in August 2021. It has since been updated for accuracy and comprehensiveness.

Joseph Molloy
Joseph Molloy

Joseph is a Liquid Web Security Operations Technician. He spends his days cleaning up malware and doing his part to keep the internet safe. He is interested in all things Linux and is always looking for something new to learn.

He enjoys cooking and playing guitar, is an avid horror and sci-fi reader, and fan of black metal music.

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.