Although Magento 2 has been released, many of the e-commerce stores are still running on Magento-1. In this blog, we will will discuss about Optimizing our Magento 1.x store. We all are aware about the need of optimizing our store for a faster speed. There are many ways in which we can optimize our magento based store. Here we will discuss how we can speed up our Magento 1.x website using a full page cache(Lesti FPC).
External Full page cache(FPC) can be used along with magento to speed up the website load time. Lesti FPC is a magento Full page cache. It caches the html pages in its cache. When a request is made to the Magento server, Magento executes the required codes and renders the pages. Lesti FPC caches this pages in its cache to serve the future requests from its cache to render the pages faster and avoid Magento to repeat the process again.
We will use ubuntu 16.04 server here for this article. For redhat and centos servers, use “yum” to install the required packages. You will also need sudo access or root access of the server to do the configurations. Follow the below steps to configure you store for a faster performance.
Install Lesti FPC.
Download the latest Lesti FPC source code. I will be using the version 1.4.9. Please check for the latest source code here.
1 2 3 |
sudo apt update && apt-get -y install wget tar cd /tmp wget https://github.com/GordonLesti/Lesti_Fpc/archive/1.4.9.tar.gz |
Now untar the Lesti FPC tar file and copy the source code to the Magento document root directory.
1 2 3 |
tar -xzvf 1.4.9.tar.gz cd Lesti_Fpc* rsync -ravh app/ /<path_to_magento_root_dir>/app/ |
Give the files appropriate file ownership. If you are running Magento with any other user or group other than “www-data”, please change it accordingly in the command.
1 |
sudo chown -R www-data:www-data /<path_to _magento_root_directory>/ |
Clear all the cache and sessions:
1 2 |
rm -rf /magento-root-dirrectory/var/session/* rm -rf /magento-root-dirrectory/var/cache/* |
To verify the installation by going to: System -> Configuration -> System -> Lesti FPC. If you are able to see the configuration options, it is installed.
If you have configured to redis-server for magento, you require an addition step to enable Lesti FPC to use redis. Else you have already configured Lesti FPC successfully.
In case you want to configure Redis-server for Magento, follow this blog. You can later return to this blog to configure Lesti-Fpc for redis.
Configure Lesti FPC to use Redis.
If redis is enabled on the server, you need to edit a file in app/etc/fpc.xml . In case it is not present, create one by copying the fpc.xml.sample file present in same path. This file lets you set appropriate cache parameters along with the lifetime of the full page cache. You do not need to make any changes to this file if you’re using the default “files” as the cache type. But in case you are using redis or memcache, you have to update this file with the appropriate cache parameters so the FPC can utilize it.
Make a backup copy of the file and open the file.
1 2 3 |
cd /<magento-root-dirrectory>/app/etc/ cp fpc.xml fpc.xml.backup nano fpc.xml |
Replace the contents of the file with below code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?xml version="1.0"?> <config> <global> <fpc> <lifetime>86400</lifetime> <backend>Cm_Cache_Backend_Redis</backend> <backend_options> <server>127.0.0.1</server> <port>6379</port> <persistent></persistent> <database>2</database> <password></password> <force_standalone>1</force_standalone> <connect_retries>1</connect_retries> <lifetimelimit>86400</lifetimelimit> <read_timeout>10</read_timeout> <compress_data>1</compress_data> <compress_tags>1</compress_tags> <compression_lib>gzip</compression_lib> </backend_options> </fpc> </global> </config> |
Clear all the cache and sessions:
1 2 |
rm -rf /<magento-root-dirrectory>/var/session/* rm -rf /<magento-root-dirrectory>/var/cache/* |
Or, clear cache from Magento Admin Panel:
System > Cache Management,
and, click on ‘Flush Magento Cache’.
Restart redis-server.
1 |
sudo service redis-server restart |
You can check the cache info by,
1 |
sudo redis-cli info |
Now you have now successfully installed Lesti FPC with redis on your server. This should result in a faster load time of your Magento store.
Enjoy!!!
In case of any help or query, please contact us.
Be the first to comment.