Complete CDN Migration Guide

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.

  1. 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.

choose a zone type

To setup a KeyCDN pull zone complete the following steps.

  1. Login to the KeyCDN dashboard and click on Zones then Add New Zone.
  2. Define a zone name and ensure the zone type is set to Pull.
  3. Enter the origin URL where you want to content to be pulled from (e.g. https://mywebsiteurl.com) and click Save.

The status of the new zone will now be set to deploying.
keycdn-deploying-zoneThis remains for about 5 minutes before the status changes to active and the zone is ready for use.

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).

  1. 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.
keycdn-zone-urlAlternatively, 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.

  1. Create a CNAME record which points your Zonealias to your zone url. keycdn-zonealias-recordDNS 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.
    
  2. Login to the KeyCDN dashboard and navigate to Zonealiases.
  3. Select “New Alias” and set the zonealias to reflect what was defined in your CDN DNS CNAME record (e.g. cdn.demosite.com).
  4. 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.

  1. 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

 http://yourwebsiteurl.com/wp-content/themes/twentyfifteen/style.css?ver=4.4.1

and replace the domain by the Zonealias you created in step 2. In this case, the new url is

http://cdn.demosite.com/wp-content/themes/twentyfifteen/style.css?ver=4.4.1

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.

  1. 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.

  1. The first step is to download a plugin such as WordPress CDN Enabler to integrate your CDN URL with your website.
  2. 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) .wordpress-cdn-enabler-settings
  3. Save your settings and double check your site’s page source to ensure that your static file URLs have been rewritten. rewrite-static-urls-html
  1. 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 usage, analytics, real-time logs, real-time stats, etc.

For a detailed explanation of the analytics available, read our article Analyzing CDN Traffic to your Website.
analytics For a more granular view of your logs, KeyCDN also allows you to perform log forwarding and have your logs received by syslog.

Other Considerations

Leave A Comment?