With just a bit of extra effort, you could get significant page speed improvements on your WordPress website by using Amazon?s Content Delivery Network (CDN).
Here I explain the second method to speed up your WordPress site using Amazon’s CDN.
To get background information on the process described here, please read my previous post: Speed Up WordPress With Amazon S3 And Cloudfront (Part 1).
Method 2: Amazon Cloudfront Origin Pull
Complete Step 0 of my previous post 🙂
It basically just involves signing up for an AWS account.
Go to the AWS Console and select the CloudFront tab and then click the “Create Distribution” button.
Select “Download” as the delivery method.
This isn’t absolutely necessary, but it is a good idea to create a CNAME record with your DNS service to route queries from your site to your distribution. This helps to maintain cleaner links in your page source. Most people use the sub domain of “cdn”. For example, if you view the page source on any page on this site, you will see http://cdn.ehikioya.com repeatedly. This appears instead of something like http://d3nt4jmz34ymkr.cloudfront.net
In this step, you decide if you will want to create a CNAME or not.
If you see a screen with the option to select Amazon S3 Origin, ensure that it is NOT selected.
Enter your domain name (If you plan to create a CNAME, enter the CNAME value you plan to create). Most of the other options can be left at their default values. Press “Create Distribution”.
The domain name (and CNAME if you entered one) will now appear in the console. Now you will need to go to your DNS service website and create the CNAME you selected in the previous step. The CNAME should point to the actual Cloudfront domain name.
Go into your WordPress admin page and set up the Cloudfront server as the place WordPress will go for all your static content files. You will do this from the WP Super Cache plugin (I assumed you already had it installed).
Go to the settings for WP Super Cache and click the CDN tab. Check the “Enable CDN Support” box. Enter the full URL of the CNAME you just created (like this: http://cdn.ehikioya.com). If you did not create a CNAME, then enter the ugly Cloudfront domain name (like this http://d3nt4jmz34ymkr.cloudfront.net). It works fine too! Save the changes and you’re in business!
To test that everything works, view the page source of your website. You should see that your static resources like images are now being pulled from the Cloudfront server. The URL of these resources will now contain your Cloudfront domain name or your CNAME as the case may be.
Note: DNS resolution may take a few hours. So your new CNAME may not become active immediately.