LiteSpeed Cache is one of the most effective ways to speed up your Magento store. This guide explains how to install and configure the LiteSpeed Cache extension for Magento 2.

What is LiteSpeed Cache?

LiteSpeed Cache (LSCache) is a server-level caching solution that:

  • Caches entire pages at the server level
  • Significantly reduces page load times
  • Works seamlessly with LiteSpeed Web Server
  • Is free to use with LiteSpeed hosting

Benefits Over Other Cache Solutions

Feature LiteSpeed Cache Varnish Built-in FPC
Server-level Yes Yes No
ESI Support Yes Yes Limited
Easy Setup Yes Complex Yes
CDN Integration Built-in Requires config No
Image Optimization Yes No No

Prerequisites

Before installing LiteSpeed Cache:

  1. LiteSpeed Web Server - Your hosting must use LiteSpeed (not Apache/Nginx)
  2. PHP 7.4+ - Recent PHP version
  3. Magento 2.3+ - Compatible Magento version

Check if you have LiteSpeed:

  • Look for LiteSpeed in your hosting control panel
  • Or check server headers

Installation

composer require litespeed/module-litemage
php bin/magento module:enable Litespeed_Litemage
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean

Via Magento Marketplace

  1. Purchase (free) from Adobe Marketplace
  2. Add to your project via Web Setup Wizard
  3. Run setup commands

Configuration

Enable LiteSpeed Cache

  1. Go to Stores > Configuration > LiteMage Cache
  2. Set Enable LiteMage Cache to Yes
  3. Click Save Config

Basic Settings

General Settings:

  • Enable LiteMage Cache: Yes
  • Default Cache TTL: 86400 (24 hours)
  • Home Page TTL: 86400
  • Category Pages TTL: 86400
  • Product Pages TTL: 86400

Cache Warming

Automatically cache pages after purge:

  1. Enable Cache Crawler
  2. Set crawl frequency
  3. Configure sitemap URL

ESI (Edge Side Includes)

ESI allows caching of page parts separately:

Recommended ESI Blocks:

  • Mini cart
  • Customer greeting
  • Compare products
  • Recently viewed

Configure in: Stores > Configuration > LiteMage Cache > ESI Settings

Advanced Configuration

Cache different versions based on:

  • Currency
  • Customer group
  • Store view

Cache Exclusions

Do not cache:

  • Checkout pages (automatic)
  • Customer account pages (automatic)
  • Pages with dynamic content

Add exclusions: LiteMage Cache > Do Not Cache URLs

Private Cache

For logged-in customers:

  • Enable private cache for personalized content
  • Set appropriate TTL
  • Configure ESI for dynamic blocks

Image Optimization

LiteMage includes image optimization:

  1. Enable WebP:

    • Stores > Configuration > LiteMage Cache > Image Optimization
    • Enable WebP Replacement: Yes
  2. Lazy Loading:

    • Enable Lazy Load Images: Yes
    • Improves initial page load
  3. Responsive Images:

    • Enable responsive placeholders
    • Reduces bandwidth usage

CDN Configuration

LiteSpeed integrates with CDN:

  1. QUIC.cloud (LiteSpeed CDN):

    • Free tier available
    • Easy integration
    • Global distribution
  2. Third-party CDN:

    • Configure CDN URL
    • Set up proper headers

Testing Your Cache

Check Cache Status

  1. View page source or headers
  2. Look for X-LiteSpeed-Cache: hit
  3. First visit: miss, subsequent: hit

Debug Mode

Enable for troubleshooting:

  1. Stores > Configuration > LiteMage Cache
  2. Enable Debug: Yes
  3. Check var/log/litemage.log

Performance Testing

Before and after comparison:

  • Google PageSpeed Insights
  • GTmetrix
  • WebPageTest

Cache Purging

Manual Purge

Admin Panel:

  1. System > Cache Management
  2. Click Flush LiteSpeed Cache

Command Line:

php bin/magento cache:clean

Automatic Purge

LiteMage automatically purges:

  • Product pages on product update
  • Category pages on category update
  • CMS pages on content update

Purge by Tag

Selective purging by:

  • Product ID
  • Category ID
  • CMS page

Troubleshooting

Cache Not Working

  1. Verify LiteSpeed server is running
  2. Check .htaccess for LiteSpeed rules
  3. Review error logs
  4. Test with simple HTML page

Stale Content

  • Check TTL settings
  • Verify automatic purge is working
  • Test manual purge

ESI Issues

  • Verify block configuration
  • Check ESI hole punch markers
  • Review debug logs

Best Practices

Optimal TTL Values

Page Type Recommended TTL
Home page 1-24 hours
Category pages 4-24 hours
Product pages 1-6 hours
CMS pages 24+ hours

Do Not Cache

  • Pages with real-time inventory
  • Personalized recommendations
  • Dynamic pricing pages

Monitor Performance

  • Set up uptime monitoring
  • Track cache hit ratio
  • Monitor server resources

Need Help?

We are here for you! If you run into any issues or have questions, our support team is happy to help you personally. Send us a message through the ticket system - we usually respond within a few hours and are happy to assist you.