If you want to use a content delivery network such as CloudFront with WordPress, you can easily use the Elevate Performance Enhancement plugin for WordPress.
First, you need to create a configuration on CloudFront to use with your site. Once you are signed up on CloudFront, and are looking at your dashboard, simply click the button “Create Distribution”. On the next page, click “Get Started” button under the “Web” section to indicate a web-based configuration. Once that’s done, CloudFront will open a configuration pane that will look incredibly daunting at first. But don’t worry, it’s quite easy to configure.
Here is what you need to change from the defaults:
- Origin Domain Name: set this to the domain of your website for example elevatewp.io for this website
- Origin Protocol Policy: set this to “Match Viewer”
- Origin ID: doesn’t matter, it usually auto-populates this
In the second section, “Default Cache Behavior Settings”, you’ll need to change the following settings:
- Query String Forwarding and Caching: changes this to “Forward All, cache based on whitelist”
- Query String Whitelist: Add a single character here, “v”. This will be used in Elevate to be able to flush the cache from the administration panel
Once that’s done, click “Create Distribution” at the bottom to start the process of provisioning your distribution. Once that’s done, CloudFront often will need about 15 to 20 minutes to distribute your configuration to its various servers around the world. In that time, your new profile on the CloudFront dashboard will say that it’s being provisioned.
First, install Elevate in your WordPress installation and then activate it. Once installed, navigate to the “Performance” settings panel. You’ll want to locate your distribution URL by navigating to your distribution on CloudFront and then examining it. The setting you want is called “Domain Name”, and it’s shown in the image for this site.
You’ll want to paste your CloudFront distribution URL into the box marked “Content Delivery Network URL”, but modify it to include http:// or https://, depending on whether or not your site uses SSL. So for this site, you would paste in https://d1dinf8sr1hcze.cloudfront.net.
As soon as your distribution status changes to “Deployed” on CloudFront, you can go ahead and enable the “Use Content Delivery Network” setting in Elevate. Once that’s saved, Elevate will seamlessly start serving your post and page images from CloudFront, which often results in a noticeable decrease in page loading time and an increase in Google Page Speed score.