LiteSpeed Technologies has taken the speed-enhancing to the next level by designing modules for all the majority of the open-source applications to contribute even further to the already fast LiteSpeed webserver. Magento, as one of the leading e-commerce applications out there, is no exception, and the module is widely considered as the fastest full-cache option for Magento 2.
LiteMage communicates correctly with the LiteSpeed webserver and utilizes the ESI (edge-side includes) technology, to punch holes in your site’s pages, building new ones that utilize the powerful public-private cache duo! In this tutorial, we are going to talk about the way you can install it and activate it for your Magento 2 website. In a separate tutorial, we are going to do an overview of the module, along with its configuration options!
To begin the installation of this module, you need to have a basic understanding of SSH. We have an excellent knowledge base category that is dedicated to the SSH service, and you should definitely check it out. Once you have logged inside your cPanel account via SSH, it’s time to navigate to your Magento 2 root directory. If you are not sure what it is, then please check out our KB article on the matter.
Once you are located in the root directory, you need to switch your Magento 2 into “developer” mode so that the application does not use any cache that can lead to issues while you are installing the module. To do so, please execute the following command:
php bin/magento deploy:mode:set developer
You will receive the following message once you do that:
Enabled developer mode.
Now, you have two options to perform the file deployment - either using Composer or directly download the files and manually doing it. We will present both ways so that you can go with whichever is more comfortable for you.
Now that you have enabled developer mode, please execute the following command to continue with the file deployment using Composer:
composer require litespeed/module-litemage
If you have never used the Composer feature before, you will be prompted for a username and password verification. You obtain these credentials from the official Magento 2 Marketplace. They will be labeled as “public key”, which is the username and “private key”, which is the password. After entering the credentials, the command will execute all its tasks:
Simple as that, the LiteMage module is successfully installed on your Magento website. You might directly jump to the "Enabling the module after file deployment" section.
If you prefer using the manual method, then you need to download the archive from this link. Afterward, you need to upload the archive to your hosting account into the root folder of Magento 2. You can do that through the File Manager tool integrated into cPanel or by using your favorite FTP client.
Once the archive is uploaded, please go back to your SSH client and execute the following command in the root directory of Magento:
This command will initiate the extraction of the archive file. Please allow the necessary time for the process to be completed.
Now it is time to create the directory and move the LiteMage module’s files there. To do that, please run the following command:
mkdir -p app/code/Litespeed/Litemage/ && mv magento2-LiteSpeed_LiteMage-master/* app/code/Litespeed/Litemage/
With this done, the new directory is created, and the LiteMage module files are moved into it.
From here on out, the procedure is the same no matter which deployment method you chose. To continue the installation, please execute the following command:
php bin/magento module:enable Litespeed_Litemage
Upon doing that, you will receive a message stating that the LiteMage module has been successfully enabled.
Next, you need to update Magento 2’s setup by running the command:
php bin/magento setup:upgrade
You will see a long output as Magento will check all the modules and will perform updates or activations wherever needed.
Afterward, you need to recompile the static files of your Magento 2. The command will vary based on your setup - Single Store or MultiStore. If you are using a Single Store setup, please execute the command:
php bin/magento setup:di:compile
If you are running Magento 2.0.5 or earlier OR you have a MultiStore setup, then please use this command:
php bin/magento setup:di:compile-multi-tenant
The static file recompilation process can take a few minutes. When completed, you will receive an output similar to the screenshot example below.
The next thing you need to do is to enable production mode for your store and re-enable the caching aspect:
php bin/magento deploy:mode:set production
Upon completion, you will see a message indicating the mode was successfully enabled.
Afterward, you need to add the following snippet of code inside your .htaccess file.
If you do not feel comfortable editing the file directly through the Command Line, you can do it from the File Manager integrated into cPanel, or over FTP.
Finally, you need to select the new full-page cache for your Magento 2 website. This is done via the admin dashboard.
The URL address of your Magento Admin Dashboard will vary, depending on what you have chosen during the installation process. If you are not sure which one it is, you can go to the root directory of your website and execute the command:
cat app/etc/env.php | grep frontName | cut -d '>' -f2
From the command output, please copy the text inside the single quotes. Afterward, go to your browser and enter “yourmagentostore.com/text-inside-the-single-quotes” and replace “yourmagentostore.com” with your actual domain name and the “text-inside-the-single-quotes” with the output of the command mentioned above. You will be forwarded to the login page, and once the credentials have been entered, you will access your administrative area.
Once logged, please select the “Stores” option from the left-hand side menu. When expanded, click on “Configuration”.
This action will redirect you to the store configuration page. After you land there, scroll down and select the “Advanced” option from the side menu located on the left. This will present three more options, please select “System”:
You will be taken to the system configurations of Magento 2. From all the available drop-downs, please select the “Full Page Cache” option. It will unveil two configuration options that seem disabled at first. To make them adjustable, please untick the box on the left side of the “Caching Application” text field and then from the drop-down menu, select the “LiteMage Cache Built-in to LiteSpeed Server”.
Finally, hit the “Save Config” button located on the top right side of the page.
That is it! Your Magento 2 is now benefitting from the LiteMage caching module. Please be sure to check our module overview tutorial, which explains the configuration options and how you can manage them. If you are not confident enough to perform the installation yourself, please do not hesitate to contact our Technical Support team over the ticking system and request a free installation!
Sebahat is a young and bright woman who has become an invaluable part of our team. She started as a Customer Care Representative, mastering that role and, along the way, growing into a tech-savvy individual who is well acquainted with every support layer of the company. Driven by her aim to improve our customers’ experience constantly, she is committed to enhancing the extraordinary support we deliver.