free
web stats

Fill the form & Get Installation Support

We don't monkey around your business.

GET IN TOUCH WITH US NOW





How to Configure Varnish cache for Magento 2?

Caching technology has become of any web server because it helps to increase the performance the website which make them load faster in shorter time period.It is essentail for the web appliaction like Magento where the main concern is reduce the load time of the store and speed up the page response time to provide better user experience to the user and increase the revenue.

One of the popular option availabe in the market for magento is varnish  to make your store more profitable.

Varnish cache is an HTTP accelerator designed specifically for the websites which has heavy content like Magento 2 for speeding up of server.With Magento 2  (both CE & EE) you get varnish integrated by default  with the support for Full page caching it not like previous version where you require to install plugin like Turpentine Varnish Cache for integarting Magento with varnish.It just need some changes to make it work for your Magento store

Things needed for performing setup

  • a user with sudo privileges 
  • apache installed on your virtual private server.

After successfulling integrating varnish with apache 2 ,we are ready for Magento 2 varnish setup for which we need to follow following steps.

The first thing we need to do is install varnish package

(https://www.linode.com/docs/websites/varnish/getting-started-with-varnish-cache/)

  1. Go to Magento 2 cache configurations:

Store -> Configuration -> System -> Full Page Cache

 

  1. Fill out Backend Host and Backend Port fields in accordance with your Varnish configurations. For example, if you performed all steps from this manual, your settings will look like the screen below.

  1. Press the “Save” button in the right corner.
  1. Then, click “Export VCL for Varnish 4”for Varnish generation with your Magento 2 Varnish version.
  1. After that, you should replace the default Varnish configuration /etc/varnish/default.vcl with configuration exported from your Magento 2 store. Run the following commands:
  1. Finally, restart varnish with the command:

service varnish restart

service apache2 restart