Drupal CDN Integration
This tutorial was made for Drupal 8.x version
Before you take any steps please backup your site and database.
1. Install the Drupal CDN module:
Download one of the recommended releases of Drupal CDN module from the Drupal.org website (You do not need to unzip this file).
Log into your Drupal administration section.
Click on Modules tab in the top navigation bar.
Click on Install new module link.
Click on Choose File button and browse to the Drupal CDN module you downloaded.
Click on Install button to install the extension into your website.
Click on the link Enable newly added modules.
Scroll down till you find the CDN module and check “enabled”. Click on Save configuration.
2. Configuring the Drupal CDN module with our CDN:
Once you access site development, click on “Configuration” at the top of the page. There scroll down to “Web Services” section and look for “CDN Integration”
Configure as shown in the pictures below
In Mapping you're adding CDN URL, which can be found in your CDN77 client panel under a specific CDN Resource.
The following settings is no longer available in Drupal 8.X
4. Details tab of the CDN module:
It provides two modes: Origin Pull and File Conveyor. If you are unsure which mode to use, choose Origin Pull, which is also the default setting. It will replace your domain name with the Origin Pull CDN's domain name in the file URL.
Next, there is the CDN mapping setting. Here you can define which files are mapped to which CDN (in case you’re using multiple CDNs or static file servers). Paste your CDN URL or CNAME here. If you’re not using a CNAME you can retrieve the CDN URL by logging into the management area of your CDN Resource. This will cause all files to be served from CDN77.
The last setting is optional but recommended - the Far Future expiration. Check this box if you want your site to run much faster. It routes the serving of all static resources through Drupal instead of the web server (Apache/nginx/lighttpd/…) and ensures that all files are served from the CDN in the optimal way. i.e. files are compressed (gzipped) and have optimal HTTP headers. These HTTP headers tell your visitors’ browsers to cache files “forever.” The URL of the changed file is updated automatically, so your visitors receive the new files immediately. However, to make this work correctly you have to serve the files through PHP (Drupal), not the web server, which is not very efficient. Alternatively, you can set cache expiration time for your CDN long enough for this to still be ok.
Now you can browse your site and check CDN integration statistics at the bottom of the page when in testing mode. If everything looks ok, just enable the module and you're all done, your site is now being accelerated by CDN77!