Magento is a well known open source e-Commerce platform. On the other side, it also contains a complex piece of PHP software which makes relatively low performance when compared to other e-Commerce solutions. To improve this situation, Magento uses the concept of Full Page Cache. Full-page Cache improves response time and reduces the load on the server. Without caching, each page might need to run blocks of code and retrieve information from the database.
In this post, I will guide to configure the full-page cache in Magento 2:
- On the Admin sidebar, tap Stores. Then under Settings, choose Configuration.
- On the left panel, under Advanced, choose System.
- Expand the Full Page Cache section.
- Set Caching Application to one of the following:
- Built-in Application
- Varnish Caching (The Varnish Caching is recommended)
- To set the time-out for the page cache, enter the TTL for public content. The default value is 86400
- If using Varnish, untick Use System Value. Under Built-in Cache, choose Varnish Cache and then complete Varnish cache Configuration sections as follow:
- In the Access list field, enter the IP addresses that can purge the Varnish configuration to generate a config file. All multiple entries are seperated by a comma. The default value is “localhost”
- In the Backend host field, enter the IP address of the backend host that generates config files. The default value is “local host”
- In the Backend port field, identify the backend port that is used to generates config files. The default value is : “8080”.
- To export the configuration as a varnish .vcl file, tap the button for the version of Varnish that you use.
- Export VCL for Varnish 3
- Export VCL for Varnish 4
- When finish, click Save Config.