Knowledge Base

How to install and configure LiteMage

This article describes how to install and configure LiteMage, the caching solution for Magento on Turbo servers. Follow the procedures in the section below for your version of Magento.

LiteMage requires the Ultra VPS License with LiteMage server license to function correctly. You can purchase this license when you select the Turbo Boost option for your server.

Magento 2

First you must install LiteMage, and then activate it in the Magento administration panel.

Installing LiteMage

To install LiteMage on Magento 2, follow these steps:

  1. Access your account using SSH.
  2. Change to the directory where Magento is installed. For example, type cd ~/public_html/magento.
  3. At the command prompt, to set Magento to developer mode, type the following command:
    php bin/magento deploy:mode:set developer
  4. To download the LiteMage plugin files, type the following command:

    wget https://github.com/litespeedtech/magento2-LiteSpeed_LiteMage/archive/master.zip
  5. To extract the files in the .zip file, type the following command:

    unzip master.zip
  6. To create a directory for the LiteMage plugin files, type the following command:

    mkdir -p app/code/Litespeed/Litemage
    You must create this directory path relative to the Magento 2 root directory. Otherwise, Magento cannot detect that the plugin is installed.
  7. To move the unpacked LiteMage plugin files to the new directory, type the following command:

    mv magento2-LiteSpeed_LiteMage-master/* app/code/Litespeed/Litemage/
    After you move the files, make sure that they have the same ownership as all of the other Magento files. If they do not, use the chown command to set the correct ownership. For example, you can type chown -R username:username * , where username represents your account username.
  8. To enable the LiteMage plugin, type the following command:

    php bin/magento module:enable Litespeed_Litemage
  9. To make the plugin settings available to the Magento Admin panel, type the following command:

    php bin/magento setup:upgrade
  10. To recompile Magento, type one of the following commands:

    • If you are running Magento version 2.0.6 or later and have only one Magento store, type the following command:
      php bin/magento setup:di:compile
      
    • Alternatively, if you are running Magento version 2.0.5 or earlier or have multiple Magento stores, type the following command:

      php bin/magento setup:di:compile-multi-tenant
      
  11. To set Magento back to production mode, type the following command:

    php bin/magento deploy:mode:set production
    If you receive an error message running this command, repeat step 10, and then try again.
  12. Using the cPanel File Manager or the SSH command prompt, open the .htaccess file in the Magento root directory in your preferred text editor, and then:

    • Copy the following text and paste it at the top of the .htaccess file:
      <IfModule Litespeed>
          LiteMage on
      </IfModule>
      
    • Save your changes to the .htaccess file.
Activating LiteMage

To activate LiteMage on Magento 2, follow these steps:

  1. Log in to Magento as the administrator.
  2. In the left sidebar, click STORES, and then click Configuration.
  3. Click ADVANCED, and then click System.
  4. Click Full Page Cache.
  5. In the Caching Application list box, confirm that LiteMage Cache within LiteSpeed Server is selected. If LiteMage Cache within LiteSpeed Server is not selected, select it in the Caching Application list box, and then click Save Config.
  6. In the left sidebar, click SYSTEM, and then click Cache Management.
  7. Select the Configuration and Page Cache check boxes.
  8. In the list box above the table, select Refresh, and then click Submit.
    To verify that the LiteMage installation is working correctly, follow the Verifying LiteMage procedure below.

Magento 1

First you must install LiteMage, and then activate it in the Magento administration panel.

Installing LiteMage

To install LiteMage on Magento 1, follow these steps:

  1. Using the cPanel File Manager or the SSH command prompt, open the .htaccess file in the Magento root directory in your preferred text editor, and then:
    • Copy the following text and paste it at the top of the .htaccess file:
      <IfModule Litespeed>
          LiteMage on
      </IfModule>
      
    • Save your changes to the .htaccess file.
  2. Log in to Magento as the administrator.
  3. On the top menu bar, click System, and then click Configuration.
  4. In the left sidebar, under GENERAL, click Web.
  5. Click Session Validation Settings, and then in the Use SID on Frontend list box, select No, and then click Save Config.

    If you currently have compilation enabled, you must disable it. To do this, on the top menu bar click System, click Tools, and then click Compilation. Click Disable at the top right.
  6. On the top menu bar, click System, click Magento Connect, and then click Magento Connect Manager.  This step takes you away from the administrator interface and you must type the Magento administrator username and password again.
  7. Get the LiteMage Extension from Magento Connect:

    • If you do not already have one, create a Magento Connect account at https://www.magentocommerce.com/magento-connect.
    • Use your web browser to visit the Magento Connect LiteMage Cache page.
    • Log in to Magento Connect, and then click Install Now.
    • Select the I agree to the extension license agreement check box, and then click Get Extension Key.
    • Click Select Key.
    • In Magento Connect Manager, under Install New Extensions, in the Paste extension key to install text box, paste the extension key.
    • Click Install, and then click Proceed. Magento Connect Manager installs the extension.
      If your Magento site becomes stuck in maintenance mode and inaccessible during plugin installation, delete the maintenance.flag file from the root directory of your Magento site. Your site should be accessible again.
Activating LiteMage

To activate LiteMage on Magento 1, follow these steps:

  1. Log in to Magento as the administrator.
  2. On the top menu bar, click System, and then click Configuration.
  3. In the left sidebar, under LITEMAGE CACHE, click LiteMage Configuration.
    If you receive a 404 Not Found error message, log out of Magento and then log back in.
  4. Click General Settings, and then in the Enable LiteMage Cache list box, select Yes.
  5. Click Save Config.
  6. On the top menu bar, click System, and then click Cache Management.
  7. Under Cache Storage Management, select the Configuration check box, and then click Submit. This refreshes the configuration cache.
    To verify that the LiteMage installation is working correctly, follow the Verifying LiteMage procedure below.

Verifying LiteMage

To ensure that LiteMage is working correctly for your site, follow these steps:

  1. Use your web browser to visit a page that is cache-enabled.
  2. Open the web browser inspector by right-clicking the page, and then click Inspect.
    The exact wording for the Inspect option, as well as the options in the following steps, may vary depending on the browser you are using.
  3. Select the Network tab, and then refresh the page.
  4. Select the item from the list that corresponds to the current HTML page (this is usually the first item ending in .html).
  5. Under Headers, if you see the following response header, then LiteMage is working correctly:
    X-LiteSpeed-Cache: hit,litemage 
    

    Alternatively, if you see the following header, refresh the page and check again:

    X-LiteSpeed-Cache: miss,litemage

More Information