CDN is the acronym for Content Delivery Network – a system of interconnected servers located all around the world. The role of CDN is to distribute cached web content and web pages to internet users.
This is why a CDN is a must-have. It speeds up the website’s loading time by distributing bandwidth across multiple servers, and increasing the speed of your website will allow it to rank higher in search engine results. You may also analyze your website and discover how it performs by using various online tools before you decide which CDN to use.
If you are using WordPress CMS platform, you have the option of setting up a CDN. It’s not that complicated or time-consuming actually – the entire CDN implementation process takes approximately 15 minutes. Here is how to configure WordPress to use a CDN.
Choosing the Best CDN Service for Your Website
Before you can start the configuration process, you will need to choose a CDN service provider. In order to get the best price-to-quality balance, you have to get informed on how to choose the right CDN. Some of the items that you have to check off your list are: cost, functionality, performance and location of the CDN servers.
Make sure that the CDN you are about to choose has analytics and testing features. With these you will be able to measure response time and evaluate the strength of the CDN. Good CDN service providers have well-designed and easy to read custom-granular reports that allow users to get access to full global metrics (cache hit/miss ratio percentage, deliveries/requests by data centre, transfer/request miss ratio, average end-user transfer rate, etc.).
It is important to do an online research into users’ experiences about using the CDN service in question. Choosing the right CDN is an important task and you should get as much information before making a decision.
Configuring WordPress with CDN
Creating the Pull Zone
For the purposes of this tutorial, we have chosen the MAXcdn CDN service provider. Once you have gotten your CDN account, login to gain access to the control panel. In the navigation bar on top of the screen, click on the “Zones” tab. Then find the “Pull Zones” tab and click on the “Create Pull Zone”. The Pull Zone automatically pulls the data from a location specified after the first request for the file. You have to fill three fields:
- Name – Simply name the Pull Zone
- Origin Server URL – Here you enter the root domain name to be distributed over the CDN (http://yourdomainname.extension). If your website already redirects to a “www” domain, make sure to add “www” before the site name and extension.
- Label – Here you enter the description of the zone you are creating.
After clicking, the process of zone creating starts and it usually lasts for couple of minutes. After it is completed, you will have to create a CNAME record for the “cdn.yourdomainname.extension” to “nameofthepullzone.yourdomainname.netdna-cdn.com”.
Creating a CNAME record
CNAME is a standard part of a DNS record. When website visitors try to access a website, CNAME will tell them where the recourses are located. In order to create CNAME record, you will have to log in to your domain’s Control Panel. In the Search Box accessible through the Control Panel type “DNS ZONE” and select the “Simple DNS Zone Editor” option. Go to the box named “Add a CNAME Record” and fill the two fields:
- Name – Here you should only enter the prefix of your custom domain (in this example, it is CDN), the Control Panel will autocomplete the “yourdomainname.extension”
- CNAME – Here you should enter the “nameofpullzone.yourdomainname.netdna-cdn.com”
Make sure to check the complete guide on how to create a CNAME DNS Record published by the CDN service provider you have picked. This way you can avoid setup errors that can cost you a lot of your time.
Installing and Setting the WordPress CDN plugin
The most popular WordPress caching plugin is “W3 Total Cache”. It is very easy to setup and it is compatible with many CDN service providers. Before installing this plugin, you will have to uninstall any other caching plugins that you might have active on your website. This is very important, because it will make sure that W3TC runs without any issues.
Once you access your WordPress admin panel, click on the Plugins and then click on Add New. Enter “W3 Total Cache” in the search box, then click on the “Install Now” link supplied right under the “W3 Total Cache” plugin name.
After you have installed the plugin, go to “Performance” and select “General Settings”. When you scroll down, you will find the CDN configuration box, click on it. Check the “Enable” box. Select the NetDNA/MaxCDN option in the CDN Type dropdown menu and click the “Save all Settings” button.
In the next step you will have to provide “Authorization Key” and enter the replacement for the default host name. If you click on the red link “Specify it here”, the plugin will take you to your CDN provider page. In this example we are using MAXcdn provider. Once you’ve logged in to your account on MAXcdn, you should click on Manage Account, then choose the API tab where you can get your API key.
Go back to the plugin settings that you have open in the first tab and enter this API key. In the “Replace Site’s Hostname With” field enter “cdn.yourdomainname.extension”. Now click on “Save all Settings” and then Test NetDNA. If you have done everything alright, you will get the “Green Test Passed” report next to the “Test NetDNA” button. For troubleshooting, check the WordPress forums.
Before setting this all up, make sure to check the metrics on the performance panel, so that you can compare the page loading speed values before and after the CDN implementation.
Setting up a WordPress CDN doesn’t take a lot of time. But, as you can see, to successfully set it up, you will need to have at least some technical skills. In order to make sure that everything goes over smoothly, feel free to go through this guide several times and to take one step at a time, so that you don’t forget to set up any of the options we have addressed here.
Marco Mijatovic is a blogger and WordPress enthusiast. He’s one of the guys behind FirstSiteGuide so make sure to check out his other work, including in-depth guides and posts where he features latest WordPress insights.