Easy guide to set up a CDN for WordPress

This blog post will be about CDN for WordPress. It’s blog post number two in a series of three blog posts on how to improve performance on your WordPress site. This blog post will explain how easy it is to set up a CDN for your WordPress site. If you missed part one, I suggest that you read that as well. Part one was about how to optimize images.

What is a CDN?

content delivery network or content distribution network (CDN) is a geographically distributed network of proxy servers and their data centers. The goal is to distribute service spatially relative to end-users to provide high availability and high performance. CDNs serve a large portion of the Internet content today, including web objects (text, graphics and scripts), downloadable objects (media files, software, documents), applications (e-commerce, portals), live streaming media, on-demand streaming media, and social networks.

Source: https://en.wikipedia.org/wiki/Content_delivery_network

So it’s a way to distribute content from another domain/URL. Mostly images, CSS and Javascript files will be served from a CDN (this can, of course, be configured). In other words, static resources.

Why bother with a CDN?

Well, a CDN can improve the performance of your site quite dramatically. To explain the benefits with a CDN I think you should read these two blog posts,

If you think CDN sounds complicated, it’s not. Especially not if you’re running WordPress. KeyCDN have a great CDN for WordPress plugin.

What CDN for WordPress am I using?

I’m using a CDN called KeyCDN. Their slogan is,

A Simple, Fast & Reliable CDN
The real-time content delivery network built for the future – HTTP/2 ready.

Source: https://www.keycdn.com/

KeyCDN, a great CDN for WordPress

I like their slogan for several reasons, first of all, it’s true. KeyCDN is a very simple CDN to set up and use, it’s very fast and I haven’t experienced any downtime or other problems with them. They are also ready for HTTP/2 which is a really important thing. If you don’t know what HTTP/2 is and want to know more, simply read the blog post I linked to above under the section Why bother with a CDN.

Another great thing is that they are extremely cheap to use. Just to give you an example, if you use one of their servers located in Europe or North America, the first 10TB costs $0.04 / GB. Let’s say you have 1MB of images and other static resources on a page, 1000 page visits will cost you $0.04. Not very expensive, right? Actually, it will be lower, because if some of those visits are done by the same person/browser many of the static resources will be cached in the browser.

I also think KeyCDN is a good company. KeyCDN is a privately owned company that is located in Switzerland. They are also huge fans of open source, so if you’re running an open source project you can even use them for free.

The last thing I’m going to mention is that KeyCDN is very easy to set up, they even have a great plugin to enable CDN for WordPress.

Set up KeyCDN

First, you need an account at KeyCDN. Simply visit their homepage and sign up. (If you’re using this link when you sign up you’ll get $10 for free to use on their CDN service!)

When you have signed up I suggest you read their Getting Started guide. That guide should be enough to get you up and running.

But the main points and how I set up KeyCDN as the CDN for a WordPress site is the following steps,

  1. Create a new Zone. I use a Zone for each site.
  2. Choose the name of the zone and the type (you should probably use Pull). Make sure to enable Shared SSL under advanced settings if your site is using an SSL certificate/HTTPS (If you don’t use HTTPS you should fix that immediately!). When you’re creating a new Zone you also need to enter the origin URL, that is your websites URL. In my case, https://www.danielnordmark.se.
  3. After step two is complete, KeyCDN is starting to download all static resources from your site. This will take anything from a minute to several minutes. All depending on how large your site is. When the Zone is ready it should look like this (when the progress bar is finished you might have to reload the page),How it should look like when a Zone is ready
  4. Install the plugin on your site. The plugin is called CDN Enabler and is made by KeyCDN. You find the settings under Settings -> CDN Enabler.
  5. The only this you need to do is to enter your CDN URL (Not your website URL, it should contain your zone name and end with kxcdn.com, unless you use your own certificate). Make sure that both Use CDN for relative paths and Enable CDN for HTTPS are checked if you’re using HTTPS on your website.
  6. Enjoy a (hopefully) faster website! 🙂

How to get $10 for free to use on KeyCDN

I promised that you should get $10 for free to try KeyCDN. All you have to do is to follow this link and sign up for a new account.

Having any problems?

Feel free to leave a comment below and I will try to help you. If it’s very specific to KeyCDN, they have a great and friendly support that can help you with pretty much anything related to their service.

Disclaimer: Some of the links are so-called affiliate links. But every single word is my own opinion. I wrote this blog post to show you how easy a CDN can be to use.


Just another developer and a true code monkey! I enjoy working will web, mobile and system development. I've been a developer for all my life (or at least since I was six years old) and have ~15 years work experience.

Leave a Comment

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

Hope you like cookies, if not. Too bad for you! ;-)

Scroll to Top