one magento developer

my experiences about magento

how to check varnish cache is enabled on Magento 2

here is 3 way to check the varnish cache is enable or not.

Check varnish cache is enabled by website

this website helps you to check it https://isvarnishworking.uk/. just put your website URL and push the check botton

check varnish cache is enable by header

open your bash or terminal and run belove command:

curl -I -v --location-trusted 'https://gh-darvishani.com/'

As you know you should change ‘gh-darvishani.com’ to your shop or website URL.

check your response to find something like this:

X-Magento-Cache-Control: max-age=86400, public, s-maxage=86400
Age: 0
X-Magento-Cache-Debug: MISS

check varnish cacke is enable by Magento directory

I know it’s a little wire but this way is the trustest way to check enabling varnish.

The Magento always creates ‘var/page_cache/’ files but, when we use varnish cache the page cache will be empty. let’s do it step by step:

1: remove ‘var/page_cache/’ by this command

rm -rf 'mg_root/var/page_cache/*'

‘mg_root’ is your Magento root directory.

rm -rf is a danger command. please be careful when you are using this command

2: restart your varnish cache service by this command:

service varnish restart

3: check the page cache for finding subdirectory by this command:

la -lah var/page_cache/*

if it was empty then your varnish cache is enabled.

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>