This knowledge base article will show you how the steps needed to configure WordPress to use Amazon CDN to speed up the delivery of your WordPress web pages to your visitors.
If at any point you need help please contact us. For Hosting Photography customers we can configure part or all of this for you.
It is assumed that you have an Amazon Web Services (AWS) account. If not you can register for one at https://aws.amazon.com/
WordPress W3TC Plugin
We will also assume that you have the W3TC plugin installed in your WordPress site. This is available at https://wordpress.org/plugins/w3-total-cache/
Configuring Amazon AWS
Create an Amazon User and Assign Permissions
- From the AWS Manager click on Identity and Access Management in the Security & Identity Section.
- From the Dashboard menu click Users.
- Click the Create New User button.
- Enter a username and click Create button. Ensure that Generate an Access Key for Each User remains checked.
- Your user will successfully be created. We need to record the credentials so expand the section which says Show User Security Credentials.
- Make a note of the Access Key ID and Secret Access Key.
Create a New Amazon User
Enter a Username
Note the User Credentials
Assign CloudFront Policy to User
- Click on the User you have just created.
- Click the Attach Policy button.
- Search for the policy CloudFrontFullAccess and select and click Attach Policy button.
Attach Amazon Policy CloudFrontFullAccess
We are now finished in Amazon. We can proceed and create our DNS CNAMEs in cPanel and then configure W3TC within WordPress.
cPanel DNS Configuration
Create CNAMEs within cPanel
- Log into your cPanel Control Panel.
- Click on Simple Zone Editor under the Domains section.
- In the section Add a CNAME enter cd1 as the name, and your Amazon CloudFront Domain Name as the NAME. In our screenshot this would be dkqte338ku838.cloudfront.net
- Enter all your CNAMEs with the same CloudFront Domain Name.
Configure W3TC within WordPress
Configure W3TC within WordPress
- Select Performance > General Settings from the WordPress administration menu.
- Scroll down to CDN and choose Amazon CloudFront from the options (Origin Pull / Mirror) . Click Save all settings.
- Select Performance > CDN from the WordPress administration menu.
- Scroll down to Configuration.
- Enter your Amazon Access Key ID and Amazon Secret Key (noted from earlier).
- Add your sites CNAMEs (cdn1.hostphotography.com, cdn2.hostphotography.com etc…)
- Save all Settings.
- Return to configuration and click Create Distribution.
- Check in Amazon AWS that the distribution has created before enabling CDN in WordPress. It may take 10 minutes or more to create in Amazon AWS. When created the status of the distribution will change from In Progress to Deployed. You can check this from the AWS Manager by selecting CloudFront Distribution in the Storage & Content Delivery section.
- Enable Amazon CDN by setting Enable to checked in Performance > CDN configuration.
WordPress W3TC Amazon CDN Configuration
Check Amazon CloudFront Distribution
Amazon CDN is now delivering parts of your website to visitors.
Hosting Photography specialized in hosting for photographers. We fully support hosting WordPress and as part of our managed service we also offer best effort support and configuration of WordPress, from installation to configuration of advanced options like Amazon CDN.