Setting Up CDN With Magento

Thank you for purchasing a Nexcess CDN. The following steps will guide you in configuring your Nexcess CDN with your Magento e-commerce store. If you have any questions or are unsure about a particular part, please feel free to send us an e-mail at support@nexcess.net.

  1. Purchase a Nexcess CDN plan or use a Magento hosting plan that comes with CDN access.
  2. Login to your client portal.
  3. On the left menu click on All Services which will show you your Nexcess based services.
    Client Portal Example Showing a CDN Service
  4. You will see a Content Delivery Network service. Next to the service name is a button labeled Options. From here you can login directly to the EdgeCast control panel using the CDN Control Panel option.
    Client Portal Example Showing CDN Control Panel Access Option
  5. From within the control panel you can configure the large and small HTTP delivery mechanisms.
  • NOTE: The large delivery mechanism is targeted at files of 300 kilobytes or higher (images, videos and other rich media). The files for the large delivery are stored on disk at the CDN edge servers. The small delivery mechanism is meant for javascript, CSS and other small files delivered via the CDN. These files are stored in memory on the CDN edge server.
    Figure 03

Large HTTP Delivery Configuration

  1. Click on the HTTP Large tab at the top.
    Figure 04
  2. Click on Customer Origin on the sub-menu below the tabs.
    • The CDN uses what's called a customer origin meaning that the files ultimately are delivered from the customer servers (your Nexcess server) directly. For Magento you'll need to setup a customer origin that points to the root of your Magento store.
      Figure 05
  • For the sake of example imagine your store was store.nexcess.net. For the Directory Name field you can enter any value so just use magento. Leave the HTTP Edge Protocol checkbox checked. In the Hostname or IP Address field put your store URL (http://store.nexcess.net in our example). Then click the Add button next to the Hosting or IP Address field. Finally, click the Add button at the bottom of the screen.
    Figure 06

Small HTTP Delivery Configuration

NOTE: These changes may take up to an hour to be pushed out to all CDN locations so your CDN URLs will still take time to function. Do not edit any of the Magento configuration values until the URLs mentioned below are fully working. You can verify this by going to them in your browser.

  1. Click on the HTTP Small tab at the top.
    Figure 07
  2. Click on Customer Origin on the sub-menu below the tabs. For Magento you'll need to setup another customer origin that points to the root of your Magento store.
  • Again, for the sake of example imagine your store was store.nexcess.net. For the Directory Name field you can enter any value so just use magento. Leave the HTTP Edge Protocol checkbox checked. In the Hostname or IP Address field put your store URL (http://store.nexcess.net in our example). Then click the Add button next to the Hosting or IP Address field. Finally, click the Add button at the bottom of the screen.
    Figure 08

Verify Settings

Now that you have both the small and large customer origins verify they are working by using the URLs provided on the Customer Origin screen and appending some Magento specific destinations.

  • For example, our URL provided for small HTTP is:
    http://smhttp.697.nexcesscdn.net/803BF5/magento
  • To test that this is working we just need to append /js/mage/cookies.js to make the full URL:
    http://smhttp.697.nexcesscdn.net/803BF5/magento/js/mage/cookies.js
  • When visitiing this URL (after adjusting for your own account) you should see the cookies.js file displayed in your browser.
  • For large HTTP use the following URL (again, after adjusting for your specific account):
    http://lghttp.697.nexcesscdn.net/003BF5/skin/frontend/default/blank/images/cvv.gif

Update your Magento Install

  1. Update your Magento install to use the new CDN based URLs by simply going to System → Configuration → Web and then selecting the Unsecure section. You just need to edit the Skin, Media and JavaScript base URLs. by substituting in the large CDN base URL for Media and Skin and the small CDN base URL for JavaScript. For instance, in our above example we'd use the following:
    • For Skin: http://lghttp.697.nexcesscdn.net/803BF5/magento/skin
    • For Media: http://lghttp.697.nexcesscdn.net/803BF5/magento/media
    • For JavaScript: http://smhttp.697.nexcesscdn.net/803BF5/magento/js
  2. Just save the settings and you're now using the CDN!
    Figure 09

Purging The CDN's Cache

If you want to purge the CDN at any time you can do so via the CDN control panel by again clicking on large or small HTTP and then clicking on the My Edge sub-menu. Alternately, you can purge all URLs at once by simply using our client portal and selecting the Purge CDN Cache option next to the CDN service.

Turning On CDN Compression

To get the most out of the CDN you'll want to turn on compression which makes each request smaller. You'll need to do the following for both the HTTP Large and HTTP Small to fully utilize the CDN's compression ability.

  1. Click on HTTP Large
  2. Click on Cache Settings
  3. On the left menu, click Compression
    Figure 10
  4. You will see the compression enable/disable radio buttons. Turn compression on here.
    Figure 11
  5. You also need to add the following text to the end of the File types box:
    ,application/javascript


    Figure 12

  6. Save the settings and within an hour you'll see smaller files! Make sure you do the same for HTTP Small as well.
 
nexcess-cdn-magento-setup.txt · Last modified: 2011/12/06 14:37 by kmartin