We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.

Your Digital Commerce Experts
Nexcess Logo

How to install the Nexcess CDN with ExpressionEngine

September 08, 2019

How to configure your Nexcess CDN with your ExpressionEngine service.

Many businesspeople wonder How Does a CDN Work to Speed Up Your Ecommerce Site? but they will discover that the reasons are remarkably straightforward. Review the content, resources, and links in this article to learn more about those reasons in full detail.  

What you need

  • CDN plan purchased with Nexcess. If you do not yet have a CDN plan, visit our website.
  • An active ExpressionEngine account with Nexcess.

Method

This procedure consists of the five steps below.

1: Configure customer origin: HTTP Small Platform

Configure the HTTP Small delivery platform as instructed in How to configure a CDN customer origin server.

Attention: Choosing the wrong platform for the type of content that you would like to serve can cause problems for your website. Therefore, it is very important that you select the correct platform for the type of content that you would like to serve.

After configuring your customer origin, it will take approximately one hour for the changes to be pushed to all CDN locations. Once propagation is complete, you can use the new CDN URL to access your content over the CDN.

2: Create a user-friendly CDN (CNAME) URL

You can choose to customize the CDN URL to be a simpler and more user-friendly name by configuring the CNAME file for your domain. Follow the steps in How to create a CNAME URL with Edgecast CDN.

If you do not want to configure the CNAME files, use the full URL that was provided after you configured your origin server in the HTTP Small procedure.

3: Set up the .htaccess file 

  1. Add the following code to the ExpressionEngine's site root .htaccess file:
<FilesMatch "\.(gif|png|jpg|jpeg|css|js)$">
ExpiresActive On
ExpiresDefault "access plus 1 week"
FileETag none
</FilesMatch>

The code above sets the expiration for the headers correctly so that browsers cache the files once downloaded from the CDN.

RewriteCond %{REQUEST_FILENAME} \.(gif|png|jpg|jpeg|css|js)$ [NC]
RewriteCond %{HTTP:X-Host} !.*nexcesscdn\.net$ [NC]
RewriteRule ^(.*)$ http://wpc.a64f.edgecastcdn.net/80xxx/images/$1 [L,R=301]
  • The first rewrite condition matches any images, CSS, or javascript being downloaded.
  • The second rewrite condition makes sure the request is not from EdgeCast. The second rewrite rule ensures that content is pulled locally.
  • The rewrite rule 301 redirects the request to the customer origin or CNAME URL. The URL shown is the URL provided by EdgeCast.

4: Purge the CDN cache

Follow the instructions provided in How to purge CDN cache.

5: Activate CDN compression

Follow the instructions provided in How to activate CDN compression.

Troubleshooting

If any elements on your site appear to be missing, it could be due to one of the following:

  • The CDN has not fully cached all of your website's content. It takes approximately one hour for the CDN to cache content. Also, any time cache is flushed, it will take approximately one hour to re-cache.
  • The CDN configuration settings are not properly defined. Follow the steps provided in this article to verify that you have entered the correct settings.

For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.

Jason Dobry