Important note

This tutorial assumes you have already created a Pull Zone.

The CDN module add-on for Drupal will alter URLs, so your static content will load from the CDN servers, as opposed to your origin server. The module provides two modes: “Origin Pull” and “File Conveyor”. For setting up the site to use our CDN you need to only use “Origin Pull,” which is basically used as a domain name rewriting mode.

Installing Drupal CDN

  1. Login to your Drupal admin panel, click “Modules”, then click “Install New Module”.
  2. In the “Install from a URL” box, enter the CDN Module URL: http://ftp.drupal.org/files/projects/cdn-7.x-2.6.zip (check the official Drupal CDN Project Page for the newest stable version), and click “Install”.
  3. Now click on “Configuration”, then scroll down to click on “CDN”. In the “General” tab, tick the “Enabled” Radio Box then click “Save Configuration.”
  4. Click on “Details” then select “Origin Pull”. For the “CDN Mapping” box, enter the CDN URL in the following format: http://foo.bar.netdna-cdn.com
    (please note that the URL should be replaced with the original CDN URL you have).
  5. Click “Save Configuration”.

Your website should now be using CDN services, and you can confirm this by reloading your website and viewing the page source. If your Origin URL is rewritten to the CDN temporary URL you are all set.

Important note

In some cases you will have to tweak some default Drupal functions in order to properly implement the CDN:

  1. Navigate to admin → settings → performance
  2. Enable normal caching.
  3. Disable “Page compression”, “Block cache”, “Optimize CSS files” and “Optimize JavaScript files” then click “Clear cached data.”
  4. Navigate to admin → settings → advagg → config
  5. Disable “Enable Advanced Aggregation”, “Use AdvAgg in closure” and “Gzip CSS/JS files” then click “Flush AdvAgg Cache.”
  6. Navigate to admin → settings → advagg → bundler
  7. Disable “Bundler is Active.”
  8. Navigate to admin → settings → advagg → css-compress
  9. Disable “Compress CSS Files” and “Compress Inline CSS.”
  10. Navigate to admin → settings → advagg → js-compress
  11. disable “Compress JS Files”, “Compress Inline JS” and “Enable Packer.”

NOTE

To ensure you implemented MaxCDN correctly, you can view the source code of any page to confirm that the CDN domain is being used for static assets instead of your origin domain. You can also use tools like pingdom, gtmetrix, webpagetest that can give you more detailed reports on your CDN implementation status.

  • GĂZAR

    I don’t see anything about changing or adding DNS in Cpanel. Is that not needed when using maxcdn? Setting this up, does it mean my images, css and js will be served by CDN? What if I am using an adaptive image module to serve my images scaled? Will they be served by MaxCDN as well? These are really important matters and a lot of people wish to know.

    • Ivan Dabic

      Hello Gazar!

      This is the approach that doesn’t require DNS change in any way (add or edit records). Rather, you’ll be installing module that will alter your URLs and change them to reference MaxCDN domain with your image/css/js uri appended (http://zone.alias.netdna-cdn.com/image.png). This way we’ll go to your origin and cache files so we can deliver them later.

      As for your image module, I suggest that you send us an email to support@maxcdn.com with more details and we’ll get back to you as soon as possible after we research this module you are using.

      • GĂZAR

        Thanks a lot! I’ll test it these days using your trial offer and get back to you, see how it works. The module is cs_adaptive_image, wonderful approach to serve images based on viewport. I would rather have picture but it is widely not supported.
        Thanks again!