WpW: How to Set Up a CDN with LSCache
Welcome to another installment of WordPress Wednesday!
Disclaimer: The information contained in this post is accurate for LSCWP v1.5. If you are using a newer version of the plugin, some details may have changed. Please refer to our wiki for the latest!
LiteSpeed Cache for WordPress has the ability to support your Content Delivery Network usage. This refers to reverse-proxy CDNs only. If you are using Cloudflare, which is not a reverse-proxy, but actually a distributed proxy server, then you do not need to do anything special in your WordPress setup. You can use Cloudflare and leave the CDN tab disabled.
For the rest of you, this quick guide should explain how the different settings between your CDN and LiteSpeed relate to each other.
CNAME setup in the CDN
For this guide, we’re going to assume you have already set up your CDN account, and added your site (let’s call it
example.com) according to the CDN’s instructions.
Make sure that your CDN is configured to cache static files only. Dynamic content will be handled by LiteSpeed.
Your CDN configuration screen should have an area for adding a CNAME record. Look for it under “DNS Editor” or something along those lines.
The goal here is to set up a custom domain to be used only by the CDN. For example,
cdn.example.com. Follow the CDN’s instructions for adding the CNAME record.
Once that is complete, and the domain is active, we’ll be ready to tell WordPress how to proceed.
LiteSpeed Cache CDN Settings
Now that your CDN is set up and your static content is ready to be served by the CDN, you will need to let WordPress know about it. You can do this through LiteSpeed Cache.
In your WordPress Dashboard, navigate to LiteSpeed Cache > Settings > CDN.
Set Enable CDN to
Set CDN URL to
Set Original URL to
The remaining settings can be used to let LSCWP know which static files will be served by your CDN.
And that’s it! Once you save your changes, LiteSpeed Cache for WordPress will substitute the CDN URL for the Original URL in the static copies it saves of your dynamically-generated code, wherever appropriate.
Want to learn more about how all of this works? We’ve written about our CDN support in some depth before. You can check that out here.
Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!
Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:
- Subscribe to the WordPress Wednesday RSS feed
- Download LiteSpeed Cache for WordPress plugin
- Learn more about the plugin on our website