A caching plugin in a necessity for every WordPress website. It helps with speeding up page load time promoting faster content delivery. And if you’re hosting your site on a LiteSpeed web server, then LiteSpeed Cache is the best option.
LiteSpeed cache (LSCache) was made specifically for use with LiteSpeed web servers. There are exclusive features only available when using with LiteSpeed.
Setup is easy and there’s also an option to directly integrate Cloudflare CDN for even more throttle. A lot of LSCache’s default configurations are fine out of the box but you can further optimize if for speed with some tweaks.
LITESPEED CACHE SETUP GUIDE WITH CDN
- 1. Install LiteSpeed Cache & Cloudflare
- 2. Setup LSCache Basic Options
- 3. Setup LSCache Advanced options
- – Minifiy and DNS Prefetch
- – Lazy Load Images with Smooth Fade-In
- – Integrate Cloudflare CDN with API Key
- 4. Activate Cloudflare Speed settings
- 5. Purge all cache
LSCache is free to use. However, the caching function won’t work on Apache or Nginx – a LightSpeed web server is a requirement. To unlock its full potential, you have to be hosting your site with a web host using LiteSpeed.
LITESPEED CACHE FEATURES
Here is a list of general and exclusive features of LiteSpeed Cache. The general features will work with any web servers while a LiteSpeed web server is required for the exclusive options.
There are many general features that still work to reduce HTTP requests even if you’re not on a LiteSpeed web server. Here are some notable ones; some that may not be included with other free caching plugins.
- • QUIC.cloud CDN Cache
- • Object and Browser Cache
- • Image Optimization (Lossless and Lossy)
- • Combine CSS/JS & Minify CSS, JS, HTML
- • Auto generate Critical CSS
- • Lazyload images and iframes
- • CDN support including Cloudflare API
- • Asynchronously load CSS/JS
- • Database Cleaner and Optimizer
- • PageSpeed score optimization
- • OPcode Cache
- • CSS HTTP/2 push
- • DNS Prefetch
- • Multi Site support
- • WebP image format support
LITESPEED WEB SERVER EXCLUSIVE FEATURES
These features are only available when using LiteSpeed cache plugin on a LiteSpeed Webserver. There’s more to this list that can be found on their official plugin page.
- • Auto page caching
- • Event driven auto purge of pages
- • Cache private pages for logged-in users
- • WordPress REST API calls caching
- • Separate caching of desktop and mobile views
- • Purge scheduling for specific URLs
- • WooCommerce and bbPress support
- • Exclude pages from cache
- • Cache crawler
- • HTTP/2 & QUIC support
- • ESI support
LITESPEED VS NGINX VS APACHE BENCHMARKS
LiteSpeed with LSCache is better at handling requests per second when compared to Nginx with FastCGI Cache and Apache with W3 Total Cache. In fact, it is more than 10x better at handling requests per second than Apache.
LSCache is the best caching plugin when using it with a LiteSpeed web server. When paired together, it’s performance surpasses that of paid cache plugins like WP Rocket.
Using LiteSpeed Cache on a LiteSpeed web server with Cloudflare’s speed settings is a good formula for speed and efficiency. Start using LSCache with LiteSpeed’s free plan.
Installing LiteSpeed Cache plugin is as easy and locating it from the plugin marketplace and clicking Install Now and Activate.
After installing the plugin, to get it working without messing with any other options, go to:
- • Settings >> General Tab >> Toggle Enable LiteSpeed Cache to Enable
- • Navigate to Manage >> click Purge All
Installing Cloudflare is just as easy. Linking up your Cloudflare account can be done directly from your web host’s cPanel. Just search for Cloudflare.
Create a new account or login to your existing account if you already have one.
With NameHero, they give you an option for either partial (CNAME) setup or Full Zone setup.
Choosing CNAME Setup means you’d still be using NameHero’s DNS and a Full Zone Setup means you’ll be using Cloudflare’s DNS. CNAME setup option is only available with Cloudflare’s Business plan or via a partner host like NameHero or GreenGeeks.
Once your account is activated, locate your Cloudflare Domain Name Server (DNS) and change the DNS in your hosting account to Cloudflare’s DNS if you chose the full setup. You will not need to change your web host’s DNS to Cloudflare’s DNS with a CNAME partial setup.
With LiteSpeed Cache installed, let’s start with the basic settings in tabs 1 – 4. There isn’t too much to adjust here so it’s fairly straightforward. The most important part is just turning on the switch.
 – GENERAL
- • Enable LiteSpeed Cache – ENABLE
- • Default Public Cache TTL – Leave as default, 604800.
- • Default Private Cache TTL – Leave as default, 1800.
- • Default Front Page TTL – Leave as default, 604800.
- • Default Feed TTL – Leave as default, 0.
- • Default 404 Page TTL – Leave as default, 3600.
- • Default 403 Page TTL – Leave as default, 3600.
- • Default 500 Page TTL – Leave as default, 3600.
- • Automatically Upgrade – ON or OFF. I prefer to update all plugins manually. This auto upgrade function only works if WP-Cron is enabled (WP-Cron is enabled in WordPress by default).
 – CACHE
- • Cache Logged-in Users – OFF. Turning it ON will create a separate cached page for each logged in user.
- • Cache Commenters – ON.
- • Cache REST API – ON.
- • Cache Login Page – ON.
- • Cache favicon.ico – ON.
- • Cache PHP Resources – ON.
- • Cache Mobile – OFF. Only applicable for AMP pages. Leave OFF for mobile responsive sites.
- • List of Mobile Users Agents – Leave as default.
- • Private Cached URIs – Useful when you don’t want a URI to cache publicly.
- • Drop Query String – Can be helpful when a query string doesn’t change the content of a page.
 – PURGE
- • Purge All On Upgrade – ON.
- • Auto Purge Rules For Publish/Update – Leave as default. Choose All Pages if you have widgets on your blog posts.
- • Scheduled Purge URLs – For scheduling time specific purge of URLs.
- • Scheduled Purge Time – Specify time for scheduling URL purge above.
 – EXCLUDES
- • Force Cache URIs – Used for forcing cache of pages regardless of no-cache settings.
- • Do Not Cache URIs – Used to prevent specific pages from caching.
- • Do Not Cache Query Strings – Used to prevent certain query strings from caching.
- • Do Not Cache Categories – Used to prevent specific categories from caching.
- • Do Not Cache Tags – Used to prevent specific tags from caching.
- • Do Not Cache Cookies – Used to prevent specific cookies from caching.
- • Do Not Cache User Agents – Used to prevent certain users agents from caching.
- • Do Not Cache Roles – Used to prevent certain user roles from caching.
Moving onto the advanced settings, here you have more options to work with. Some settings may be more suitable for some and not others, especially tabs 5 – 6. These customizations were set with Cloudflare integration in mind so if you won’t be using Cloudflare, the settings can be different.
 – OPTIMIZE
- • CSS Minify – ON. Choose OFF if already enabled with a Cloudflare but LSCache seems to do a better job of removing white spaces.
- • CSS Combine – OFF. Turning ON can make loading of CSS not as smooth.
- • CSS HTTP/2 Push – OFF. Sends CSS to the browser before request is made but this option broke my CSS.
- • JS Minify – OFF. It is recommended to minify JS from Cloudflare. Minifying JS from a caching plugin can interfere with Cloudflare’s Rocket Loader.
- • JS Combine – ON. Turn OFF if it breaks functions in your site after enabling.
- • JS HTTP/2 Push – ON. Pushes JS to browser before request is made. HTTP/2 is required for it to work.
- • CSS/JS Cache TTL – Leave as default.
- • HTML Minify – ON. Choose OFF if already enabled with Cloudflare but LSCache seems to do a better job of removing white spaces.
- • Inline CSS Minify – ON. Turn OFF if CSS is already minified from Cloudflare.
- • Inline JS Minify – OFF. It is recommended to minify JS from Cloudflare..
- • Load CSS Asynchronously – ON.
- • Generate Critical CSS – ON or OFF. It is used to load “critical” CSS rules first so pages can load faster. I prefer OFF because I’m not working with a big file. However, Critical CSS can be helpful for large CSS files but should be left OFF if it breaks the CSS.
- • Generate Critical CSS in Background – ON.
- • Separate CCSS Cache Post Types – Used when you need multiple Critical CSS files created for a single post type.
- • Separate CCSS Cache URIs – Used for specifying URIs with different formatting for creating separate Critical CSS files.
- • Inline CSS Async Lib – ON.
- • Load JS Deferred – OFF. This will be enabled from Cloudflare with Rocket Loader so there’s no need to do it twice.
- • Exclude JQuery – ON.
- • DNS Prefetch – This preloads external domains like Google Analytics and Google Fonts before a request is made to promote faster page loads for the end user. To find the list of external domains requests are being made to, first run a speed test with WebPageTest. After the test is done, you can find the list of external domains from the “Domains” tab.
- • Remove Comments – OFF.
 – TUNING
- • Combine CSS Priority – OFF. Turn ON if you need COMBINED CSS file to load before UNCOMBINED CSS file.
- • CSS Excludes – Used to list excluded CSS files from being minified or combined.
- • Combined JS Priority – OFF. Turn ON if you need COMBINED JS file to load before UNCOMBINED JS file.
- • JS Excludes – Used to list excluded JS files from being minified or combined.
- • Max Combined File Size – Leave as default, 1.2.
- • Remove Query Strings – OFF.
- • Load Google Fonts Asynchronously – ON. Adds a preconnect to Google for downloading Google Fonts faster.
- • Remove Google Fonts – OFF or ON. I assumed this is to remove fonts that come with your theme but it doesn’t seem to do anything.
- • Critical CSS Rules – Used to set Critical CSS rules when asynchronous CSS load is enabled.
- • JS Deferred Excludes – Used when JS Deferred is enabled. You can list JS files that you don’t want deferred.
- • Remove WordPress Emoji – ON. Turn OFF if you want WordPress emojis JS file to load.
- • URI Excludes – A filter used to exclude any URLs from optimizations.
- • Role Excludes – A filter used to exclude any optimizations based on the certain user-type.
 – MEDIA
- • Lazy Load Images – ON. Turning it ON will delay loading of images when not in view which can help with initial page load speed.
- • Lazy Load Image Excludes – Used to exclude lazy loading of specific images.
- • Lazy Load Image Class Name Excludes – Used to exclude lazy loading of a group of images based on their class. I excluded image classes that I don’t want to lazy load – pretty much any images that immediately displays when a page initially loads. I’m only lazy loading images within posts.
- • Lazy Load Image Placeholder – Used to specify a placeholder image until lazy loading finishes loading.
- • Responsive Placeholder – ON. It’ll reserve a spot for your images to load so your content doesn’t shift around.
- • Responsive Placeholder Background Color – Used to choose the color of the placeholder.
- • Generate Responsive Placeholder in Background – ON to generate placeholder automatically. OFF will make the placeholder generate while the user is waiting.
- • Lazy Load Iframes – OFF. Turn ON if you are using iframes and want to lazy load them.
- • Inline Lazy Load Images Library – OFF. Turning it ON will access the JS image library inline in HTML which can reduce a HTTP request. However, the page size can get larger because it isn’t using a separate request.
- • Optimize Automatically – ON if you want to use LSCache to optimize your images. Turn OFF if you’re using a separate plugin to optimize images.
- • Optimize Cron – ON.
- • Optimize Original Images – ON.
- • Remove Original Backups – OFF.
- • Optimize WebP Versions – OFF. Turn ON if you want to save all your PNG and JPG as WebP format.
- • Optimize Losslessly – ON or OFF. Turn ON if you prefer to preserve maximum quality when compressing your images. Losslessly compresses only about 20% while lossy compresses about 70% (Approx figures).
- • Preserve EXIF/XMP data – OFF. Turn ON if you need image data such as camera equipment, copyright date, GPS coordinates, comments, etc.
- • Image WebP Replacement – OFF. Turn ON if you want to use WebP images instead of JPG or PNG for all your images.
- • WebP Attribute To Replace – Used to specify the types of images replaced with WebP.
- • WebP For Extra srcset – OFF. Used to enable WebP for images generated outside of the WordPress environment.
- Here is the CSS code, courtesy of litespeedtech, to make images fade-in smoothly when using Lazy Load.
-webkit-transition: opacity .5s linear 0.2s;
-moz-transition: opacity .5s linear 0.2s;
transition: opacity .5s linear 0.2s;
 – CDN
- • Enable CDN – OFF since we’ll be using Cloudflare. Skip straight to Cloudflare API.
- • CDN Mapping – Using Cloudflare so leave as default.
- • Original URLs – Using Cloudflare so leave as default.
- • Included Directories – Using Cloudflare so leave as default.
- • Exclude Path – Using Cloudflare so leave as default.
- • Load JQuery Remotely – Using Cloudflare so leave as default.
- • Quic Cloud API – Using Cloudflare so leave as default.
- • Cloudflare API – ON. Go to your Cloudflare profile dashboard to find your Cloudflare API and email address associated with your account.
- • Enable CDN – OFF since we’ll be using Cloudflare. Skip straight to Cloudflare API.
 – ESI
- • Enable ESI – OFF. Turn ON if you want to uncache the Admin Bar and Comment Form in a cached page. This allows you to serve uncached sections within a cached page.
- • Cache Admin Bar – Leave as default, ON, to cache the Admin Bar.
- • Cache Comment Form – Leave as default, ON, to cache the Comment Form.
- • Vary Group – Leave as default.
[A] – ADVANCED
- • Object Cache – OFF. Turn ON to cache database queries so when a repeat request is made, the request can be served from cache instead of re-querying from database.
- • Browser Cache – ON.
- • Browser Cache TTL – Leave as default, 2592000.
- • Check Advanced Cache – Leave this checked unless you’re using another caching plugin at the same time for a specific purpose. Generally, you don’t want to be using multiple caching plugins at the same time.
- • Login Cookie – Used to create a unique login cookie for handling separate LSCache plugins used by multiple sites from a virtual host.
- • Purge All Hooks – Leave as default.
- • Improve HTTP/HTTPS Compatibility – OFF. When turned ON, it saves all login cookies as HTTP so it’ll be accessible for both HTTP and HTTPS connections.
- • Instant Click – OFF. Turn ON if you want your website links to get preloaded when a user hovers over it.
[D] – DEBUG
This section isn’t required for the initial setup. It is strictly for debugging purposes so all the settings can be left as default unless you’re addressing issues.
- • Diable All Features – OFF.
- • Debug Log – OFF.
- • Admin IPs – Your IP address.
- • Debug Level – Basic or Advanced.
- • Log File Size Limit – Leave as default, 3MB.
- • Heartbeat – ON.
- • Log Cookies – OFF.
- • Collapse Query Strings – OFF.
- • Log Filters – OFF.
- • Excludes Filters – Leave as default.
- • Exclude Part Filters – Leave as default.
[C] – CRAWLER
The crawler has to be enabled by your web host so this section can be left as default. Also, turning on the crawler is not recommended if you’re on a shared plan due to extensive resource consumption.
- • Delay – Leave as default, 500.
- • Run Duration – Leave as default, 400.
- • Interval Between Runs – Leave as default, 600.
- • Crawl Interval – Leave as default, 302400.
- • Threads – Leave as default, 3.
- • Server Load Limit – Leave as default, 1.
- • Site IP – For crawling by IP instead of domain name.
- • Role Simulation – Used to crawl as a specific logged-in user.
- • Cookie Simulation – To crawl for a specific cookie.
- • Custom Sitemap – Used to crawl your own Google XML sitemap.
- • Sitemap Generation – Leave as default. Used to generate a sitemap to crawl.
- • Product Update Interval – Leave as default.
- • Use Front Page TTL for the Shop Page – OFF. Turning it ON will use the front page TTL settings from the “General” tab.
- • Privately Cache Cart – OFF to exclude cart from caching.
A Cloudflare account is required to integrate their service with LSCache. You should have already created an account from Step 1 or you can sign up for a free account if you don’t have one yet.
SPEED > OPTIMIZATION
- • Auto Minify – Only minify the JS here since HTML and CSS were minified in LSCache. However, you can test both to see which is faster. Just don’t enable them from both Coudflare and LSCache – choose one.
- • Brotli – ON. Brotli is similar to GZIP but does a better job of file compression.
- • Railgun – ON. Railgun helps with faster delivery of non-cached web pages. This option may or may not be available based on the web host you’re using. I’m hosting with NameHero and they include it free with all their plans. Otherwise, this feature is available with Cloudflare’s $200 per month Business plan.
- • Email Address Obfuscation – ON. Prevents bots from collecting your email address to lessen unwanted email in your inbox that can consume your resources.
- • Server-side Excludes – ON. Makes your content visible only to real visitors.
- • Hotlink Protection – ON. Hotlink Protection prevents other websites from linking files from your site. Visitors will still be able to view and download images from your website but this ensures that spammy sites cannot use up your bandwidth by linking back to images that’s hosted on your site.
After you’re done configuring LiteSpeed Cache and Cloudflare, purge all cache from LSCache Manage page. Try running a speed test with Google PageSpeed Insights and see how you do. There always more you can do to optimize your site for speed.
Here are some more tips to make your site load faster.
Your LiteSpeed Cache plugin should now be setup with Cloudflare. If this is your first time setting up Cloudflare, it can take up to 24 hours for the DNS to activate with your web host.
If you ever need in-house help from LiteSpeed, they are very active in their community.