This guide describes the step-by-step process of how to setup a CDN to migrate the delivery your website’s static assets to KeyCDN’s server locations. Once the below steps are complete, you will have successfully created a KeyCDN zone, integrated it with your website, and will be delivering assets from KeyCDN’s edge servers.
- Creating a Zone
The first step in how to setup a CDN is creating a zone within KeyCDN. A Pull Zone automatically pulls all of your origin server’s static content and caches at a particular edge server location upon client request. Once the content is cached, subsequent client requests will be routed to the nearest edge server location.
To setup a KeyCDN pull zone complete the following steps.
- Login to the KeyCDN dashboard and click on Zones then Add New Zone.
- Define a zone name and ensure the zone type is set to Pull.
- Enter the origin URL where you want to content to be pulled from (e.g. https://mywebsiteurl.com) and click Save.
Alternatively, using a Push Zone is recommended for uploading files greater than 10MB in size and is required for files larger than 100MB (Pull Zones don’t cache anything over 100MB).
- CDN DNS Changes (CNAME)
Once your zone is created, you have the option to use the zone url (e.g. demozone-1c6b.kxcdn.com) which is provided on the KeyCDN Zones page for integration purposes.
Alternatively, a Zonealias can be created which will provide you with a custom CDN URL (e.g. cdn.yourwebsiteurl.com). Creating and implementing a Zonealias involves adding a record in your DNS settings which is outlined in the steps below.
- Create a CNAME record which points your Zonealias to your zone url. DNS propagation may take some time depending on your TTL settings. Use the DNS check tool to verify your new record is fully propagated. You may also verify this from the terminal using a dig command.
dig cdn.keycdn.com +short website-7.kxcdn.com.
- Login to the KeyCDN dashboard and navigate to Zonealiases.
- Select “New Alias” and set the zonealias to reflect what was defined in your CDN DNS CNAME record (e.g. cdn.demosite.com).
- Select the zone you would like the alias to map to and click Add.
A Zonealias also typically requires 5 minutes before it is fully deployed and ready for use.
- Verifying Your Assets Are Accessible via the CDN
Now that you have a zone created and a Zonealias defined, test an asset path using the CDN URL to verify your assets are being properly delivered via the CDN. For example, take the origin url for a particular asset such as
and replace the domain by the Zonealias you created in step 2. In this case, the new url is
If by accessing an asset via the CDN URL is successful, then your zone is fully propagated and you can now move on to the integration phase.
- Integrate KeyCDN Into Your Website
Once this step is complete, your website will be fully integrated to use KeyCDN to deliver your static assets. We have many CMS integration and Framework Integration guides available, however this article will specifically focus on a WordPress KeyCDN integration.
- The first step is to download a plugin such as WordPress CDN Enabler to integrate your CDN URL with your website.
- Once the plugin is installed and activated, navigate to the settings page of CDN Enabler and enter your Zone URL or Zonealias (if you created one) .
- Save your settings and double check your site’s page source to ensure that your static file URLs have been rewritten.
- Checking Logs and Statistics
Now that your site is fully integrated with KeyCDN, your static assets will be delivered via our content delivery network across the globe to supercharge your content. As content is delivered via the CDN, logs and statistics are tracked and accessible via the KeyCDN dashboard. These can be accessed via the Reporting option on the left-hand sidebar. Detailed charts display various information pertaining to your zones such as analytics, top files, real-time logs, real-time stats, etc.
For a detailed explanation of the analytics available, read our article Analyzing CDN Traffic to your Website.
For a more granular view of your logs, KeyCDN also allows you to perform log forwarding and have your logs received by syslog.