How to Enable and Configure LiteMage Cache in Magento

Quick Overview

LiteMage Cache, developed specifically for Magento by LiteSpeed Technologies, is the world's fastest Magento full page cache. Making effective use of server-side caching and ESI (Edge Side Includes) hole punching, LiteMage Cache speeds up both static and dynamic pages in order to deliver superior performance and responsiveness for any Magento website. This tutorial guides you through all the steps needed to enable and configure LiteMage Cache.


The following prerequisites must be installed before LiteMage Cache can be enabled. ProperHost servers already meet these requirements. Clients can skip to "Installation Step-by-Step".

  • LiteSpeed Web Server 5.0+
  • LSCache Module
  • LiteMage module
  • PHP IonCube Loader (latest version)

* Varnish and other caches should be disabled

Set Cache Storage Path

It is necessary to specify a path that LiteMage can use to store its cached files. This can be set at the server level in the Cache settings of LiteSpeed, or for each virtual host if you are hosting multiple Magento stores on the same server. Add the below code to the vhost config for your web server. It is recommended to choose a fast disk such as a RAMDISK or SSD for maximum performance.

<IfModule LiteSpeed>
CacheRoot /path/to/litemage/cache/dir

ProperHost clients will find their cache root placed under the directory /home/<user>/litemage_cache.

Installation Step-by-Step

The process to enable LiteMage for a Magento site consists of the following steps, each of which we will go through in detail.

  • Enable the LiteMage module
  • Install and activate the LiteMage Cache extension
  • Testing the extension
  • Tips and troubleshooting
  • Advanced configuration

Enable the LiteMage module

Add the below code to the .htaccess file under the root directory of each of your Magento installations to enable the LiteMage module.

<IfModule LiteSpeed>
LiteMage on

Install and activate the Magento LiteMage extension

LiteMage includes an extension which is used to configure and control the cache from within Magento. Start by downloading the latest version of the LiteMage extension package, then follow these steps to install the package via Magento Connect:

  1. Log in to the Magento Admin Panel.
  2. (Disable Compilation from System / Tools / Compilation if it is currently enabled)
  3. Go to System / Configuration / Web. Set "Use SID on Frontend" to "No".
  4. Go to System / Magento Connect / Magento Connect Manager. (You will be prompted to enter the Admin Panel password again.)
  5. If you are updating LiteMage to a new version, you must uninstall the old version first.
    1. Updating LiteMage will overwrite LiteMage's config.xml file. Before you update, make sure to copy and save your config.xml file if you have made any customizations.
    2. To uninstall the old version of LiteMage, choose "Uninstall" from the drop down menu next to "LiteSpeed_LiteMage".
  6. Go to "Direct package file upload". Select the downloaded LiteMage package and upload. Then click "Return to Admin".
  7. Now log out and log back in to the Magento Admin Panel.
  8. Go to SystemConfiguration and click on LiteMage Configuration in the left side menu.
    1. Under General Settings, set Enable LiteMage Cache to "Yes".
    2. Click the Save button.
  9. Go to System / Cache Management. Under Cache Storage Management, check the box next to Configuration and click the "Submit" button to refresh the configuration cache.
  10. (You may now run and re-enable compilation if it was previously active)

Congratulations! LiteMage Cache should now be installed and activated for your Magento website.


To verify that the cache is working, navigate to your Magento website (e.g. a product page) and hit refresh a few times to allow the cache to build up. If LiteMage is working you should see the header "X-LiteSpeed-Cache:hit,litemage" added to the response. See the screenshot below for an example from Google Chrome browser.

Tips & Troubleshooting

Enabling LiteMage only for your IP

For initial deployment and development you can run LiteMage in testing mode. Under LiteMage Cache Configuration in the Admin Panel, add your IP address to Enable LiteMage Cache Only for Listed IPs. Remove your IP when you are done with your testing to turn on caching for all users.

Flush LiteMage Cache

Once LiteMage Cache is enabled, a "Flush LiteMage Cache" button will show up under System / Cache Management. If you click "Flush Magento Cache" or "Flush Cache Storage", it will automatically flush LiteMage Cache.

"Your installation of LiteSpeed Web Server does not have LiteMage enabled."

If you encounter a "Your installation of LiteSpeed Web Server does not have LiteMage enabled." error, make sure that you have enabled LiteMage in your Magento .htaccess file (see the Enable the LiteMage module step above).

Show punched holes

LiteMage defines a number of ESI blocks for sections of a page that should not be cached (also known as hole punching). To highlight the punched holes on a specific page, simply add ?LITEMAGE_DEBUG=SHOWHOLES to the end of the page URL. This can be useful for debugging.

LiteMage Cache Warmup

Magento includes a built-in cronjob to crawl the site and warm up the full page cache. To enable LiteMage cache warmup, go to System / Configuration / LiteMage Configuration / Cache Warmup and set Enable Cache Warmup to "Yes". The Magento cron job must also be set up correctly for the cache warmup to work.

Advanced configuration

Although LiteMage has been configured out of the box to work with the majority of Magento websites, some heavily customized sites might still need additional configuration to work 100%. For example you can add additional ESI blocks to create custom non-cachable blocks. In order to do this you must edit the LiteMage configuration file: app/code/community/Litespeed/Litemage/etc/config.xml. Please note that this requires advanced knowledge of the Magento module system and templating engine, so please consult a developer for assistance. ProperHost does not offer help with customization of this file.

Please consult the official documentation for further information.

Was this answer helpful?