Blazing Fast Cloud Servers

Server set-up in less than 1 minute, Instant scaling up or down as required, 99.95% uptime guaranteed, No hardware maintenance, Simple backup and monitoring, Unbeatable pricing.

Visit Website

How To Speed Up WordPress With Amazon CloudFront CDN + Cloudflare DNS + LiteSpeed Cache + Memcached Object Cache

Speed up WordPress

This tutorial shows you how to set up Amazon CloudFront CDN + Cloudflare DNS + LiteSpeed Cache + Memcached Object Cache.
The VPS used in this tutorial: DigitalOcean (1GB RAM, 1 vCore), i use LiteSpeed Cache + Memcached Object Cache via “DigitalOcean OpenLiteSpeed WordPress
Get $100 of free DigitalOcean credits if you sign up through this link!
Demo Theme: Twenty Twenty-One theme with default demo site
Demo domain:
Please add your domain name to Cloudflare in advance.
Please replace with your own domain name.

Affiliate Disclosure: This page contains affiliate links. If you click through and purchase an item, I may earn a commission.

Amazon CloudFront Settings:
1、Create an IAM User in AWS Console, log in AWS console and go to “My Security Credentials“

Click “Users” from the left-hand side

Click “Add user” button

Give a name to the user and check “Programmatic access”, click “Next:Permissions” button.

Click “Attach existing policies directly”, then search “CloudFrontFullAccess AWSCertificateManagerFullAccess”, now two existing policies will appear:
Check these two policies, click “Next: Tags” button.

Ignore the tags option & click “Next: Review” button.

Review details, if all is well, click “Create User” button.

Now your IAM user account is ready.

2、Install Amazon AWS CDN plugin

Go to the WPAdmin AWS CDN Setup page, input Access Key and Secret Key. Select “All Locations” under Price Class menu. Check “Instead of Amazon Cloudfront Domain name, I would like to use my custom domain:”, then click on “Create Distribution” button.
Note: if you want to use custom domain, you need to have one of these emails:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

After click “Create Distribution” button, an email will been sent to one of these email addresses, you need to check & approve the email from Amazon for Certificate approval.

You will receive an email from Amazon Web Service like the following image shows, click on the link to approve the SSL certificate.

Click “I Approve” button.

Then you will see “You have APPROVED this validation request”

3、Verify if CloudFront CDN has been created
Open AWS console, go to CloudFront, check if CloudFront CDN has been created, but the CloudFront CDN not been created. After waiting for 5 minutes, i click on “Create Distribution” button again via Amazon AWS CDN plugin, then you will get message like this:

Now the CloudFront CDN has been created.

At the same time will also give the domain name * issues SSL certificate.
Now we have Let’s Encrypt SSL for,

And Amazon Issued SSL for *

And we need to change the “General – Distribution Settings”
Distribution Settings (before)
Security Policy: TLSv1.1_2016

Distribution Settings (after)
Security Policy: TLSv1.2_2019 (recommended)

Change the “Origin Settings”
Origin Settings (before)
Minimum Origin SSL Protocol: TLSv1
Origin Protocol Policy: Match Viewer

Origin Settings (after)
Minimum Origin SSL Protocol: TLSv1.2
Origin Protocol Policy: HTTPS Only

Change the “Behaviors – Default Cache Behavior Settings”
Default Cache Behavior Settings (before)
Viewer Protocol Policy: HTTP and HTTPS
Allowed HTTP Methods: GET, HEAD, OPTIONS
Object Caching: Customize
Compress Objects Automatically: No

Default Cache Behavior Settings (after)
Viewer Protocol Policy: Redirect HTTP to HTTPS
Object Caching: Use Origin Cache Headers
Compress Objects Automatically: Yes

4、Add CNAME Record in Cloudflare DNS, untick the orange cloud, making it DNS Only.

5、Enable CloudFront CDN with LiteSpeed Cache plugin
LiteSpeed Cache CDN settings
Use CDN Mapping: ON

Original URLs: //
Note: in this tutorial, i don’t use CDN and Cloudflare CDN, only use Cloudflare DNS service. So make sure: CDN: OFF
Cloudflare API: OFF

Check if CloudFront CDN works

My Cloudflare DNS settings (before use CloudFront CDN)

My Cloudflare DNS settings (after use CloudFront CDN)

Install LiteSpeed Cache Plugin

LiteSpeed Cache Plugin Settings
Cache tab settings
Enable Cache: ON
Cache Logged-in Users: ON
Cache Commenters: ON
Cache Login Page: ON
Cache favicon.ico: ON
Cache PHP Resources: ON
Cache Mobile: OFF

TTL tab settings
You can set the cache time here, but you don’t need to change it unless you have a specific reason.
Default Public Cache TTL: 604800
Default Private Cache TTL: 1800
Default Front Page TTL: 604800
Default Feed TTL: 604800
Default REST TTL: 604800

Purge tab settings
Purge All On Upgrade: ON
Serve Stale: ON

Excludes tab settings
Here you can set what to exclude from the cache, but basically you don’t have to change it.

Object tab settings
Here you can turn the object cache on and off. If the Memcached extension or Redis extension is enabled and the connection test is passed, change it to on.
Object Cache: ON
Method: Memcached
Default Object Lifetime: 360

Browser tab settings
Browser caching stores static files locally in the user’s browser, if you enable the browser cache, the cache will be saved in the user’s web browser, and you can expect faster display.
Browser Cache: ON
Browser Cache TTL: 31557600

Advanced tab settings
Instant Click: ON

CDN Settings CDN: OFF
Use CDN Mapping: ON
Include Images: ON
Include CSS: ON
Include JS: ON

Original URLs: //
Included Directories: wp-content, wp-includes
Cloudflare API: OFF

Page Optimization > CSS Settings
CSS Minify: OFF
CSS Combine: OFF
Unique CSS File: OFF
Load CSS Asynchronously: OFF
Generate Critical CSS: OFF
Generate Critical CSS In Background: OFF
Inline CSS Async Lib: ON

Page Optimization > JS Settings
JS Minify: OFF
JS Combine: OFF
JS Combine External and Inline: OFF
JS HTTP/2 Push: ON
Load JS Deferred: OFF
Load Inline JS: Default

Page Optimization > Optimization Settings
HTML Minify: ON
DNS Prefetch Control: OFF
Remove Query Strings: ON
Load Google Fonts Asynchronously: OFF
Remove Google Fonts: ON
Remove WordPress Emoji: ON
Remove Noscript Tag: ON

Page Optimization > Localization Settings
Gravatar Cache: ON
Gravatar Cache Cron: OFF
Gravatar Cache TTL: 604800

LiteSpeed Cache Database Optimization:
Clean All
Post Revisions: Clean all post revisions
Auto Drafts: Clean all auto saved drafts
Trashed Posts: Clean all trashed posts and pages
Spam Comments: Clean all spam comments
Trashed Comments: Clean all trashed comments
Trackbacks/Pingbacks: Clean all trackbacks and pingbacks
Expired Transients: Clean expired transient options
All Transients: Clean all transient options
Optimize Tables: Optimize all tables in your database
Clean CSS/JS Optimizer: Purge all and clean all minified/combined CSS/JS data

LiteSpeed Cache Toolbox:
Purge Front Page: This will Purge Front Page only
Purge Pages: This will Purge Pages only
Purge 403 Error: Purge error pages, including 403 pages
Purge 404 Error: Purge error pages, including 404 pages
Purge 500 Error: Purge error pages, including 500 pages
Purge All – LSCache: Purge the LiteSpeed cache entries created by this plugin
Purge All – CSS/JS Cache: This will purge all minified/combined CSS/JS entries only
Purge All – Object Cache: Purge all the object caches
Purge All – Opcode Cache: Reset the entire opcode cache
Purge All: Purge the cache entries created by this plugin except for Critical CSS & LQIP caches
Empty Entire Cache: Clears all cache entries related to this site, including other web applications. This action should only be used if things are cached incorrectly.

The speed optimization method can be summarized as: Amazon CloudFront CDN + Cloudflare DNS + LiteSpeed Cache + Memcached Object Cache

Some hosting providers that support LiteSpeed Web Server:
KnownHost Fully Managed WordPress Hosting
KnownHost Shared Hosting
InterServer Web Hosting
NameHero Web Hosting

If you have any questions, please comment below.

Copied title and URL