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?
A 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.
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,
- https://gtmetrix.com/why-use-a-cdn.html (GTMetrix explains why a CDN is a good idea)
- https://www.keycdn.com/blog/keycdn-http2-support/ (KeyCDN explains what HTTP/2 is and why it’s good)
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.
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.
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,
- Create a new Zone. I use a Zone for each site.
- 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.
- 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),
- 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.
- 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.
- 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.