Magento – Magnto 2 : varnish cache issue

magento2varnish

The current website running on Magento 2.2.4 CE and we have enabled varnish cache.

How do we know if varnish cache is working or not in Magento 2?

Please advise?

Best Answer

You need to follow Magento 2 devdocs as they told step to step setting and configuration of varnish cache.
If you have already installed varnish cache on your server then you need to configure Port in admin of Developer section then you will require to final verification that it's working or not as per below guideline of Devdoc Magento 2:

https://devdocs.magento.com/guides/v2.3/config-guide/varnish/config-varnish-final.html

Full configuration Guide:

https://devdocs.magento.com/guides/v2.3/config-guide/varnish/config-varnish.html

As per Magento Docs,you can also check that Varnish cache working or not as per below steps:

Make sure the /var/page_cache directory is empty:

Step1: Log in to your Magento server, or switch to, the Magento file system owner.

Step2: Clear page_cache manually with below command

  rm -rf <your Magento install dir>/var/page_cache/*

Step3: Access one or more cacheable Magento pages by navigate some page randomly.

Step4: Check the var/page_cache/ directory.

If the directory is empty, congratulations! You successfully configured Varnish and Magento to work together! If you cleared the var/page_cache/ directory, restart Varnish.