Skip to main content

Configuring WP Super Cache with Amazon CloudFront CDN

<< Back to listing

If you are running a busy WordPress website on Amazon AWS, to further improve the speed of your website content load times you might want to enable AWS CloudFront CDN. Here is a basic run through of how to configure this.

Creating the CloudFront Distribution
Log into the AWS dashboard selecting CloudFront, click Create Distribution selecting the Web delivery method.
Enter the Origin Domain name eg: dynamo6.com
Enter Alternative Domain Name eg: cdn.dynamo6.com
Adjust any other settings for your site or simply click Create Distribution. The status will change to deployed once it is ready. Be patient as this can take about 15 minutes to complete. 

aws-create-distribution-blog

 Modifying DNS records in Route53

Now that your CloudFront distribution is created, you will need to create an alias A record for the alternative domain name you specified which will point to your CloudFront address. An alias record set is a Route53 specific extension that lets you choose an AWS resource rather than entering an IP address.

Within Route53 go to the record sets for your hosted zone, click Create Record Set
Enter the prefix you decided on eg. cdn
Leave record type as A – IPv4 address
Select Alias: Yes, you will then be able to select your CloudFront distribution from the dropdown list that appears in the Alias Target field. Save the record.

image02

Configuring WP Super Cache

Before you enable WP Super Cache, check that you can now resolve the domain record. The results of the lookup should reply back with multiple addresses.

image00

On the WP Super Cache settings on the CDN tab, select Enable CDN support, enter your URL eg http://cdn.dynamo6.com adjust other settings as you need such as directories to include, files to exclude and save changes. WP Super Cache will rewrite the url from your base url eg www.dynamo6.com to cdn.dynamo6.com
To check its working open your website in a browser and check the source, you should see the new url referenced.

If you’d like to talk more about development in AWS or WordPress, please don’t hesitate to contact the team.