When we have installed Varnish on your hosting account, you can use these tools to manage Varnish.
This command will stop and start the Varnish daemon. The cache will become empty, the VCL config will be read again. If there is a fault in your VCL, Varnish will not start after stopping.
You should need this command only when you are debugging.
Certainly you should not add this command to your crontab. Please talk to us if you need to do it in a cron job.
This command will instruct Varnish to re-read the VCL config. The syntax will be checked before reloading. Varnish will keep the cached data.
Purge an URL
The matching URL will be purged from cache on all domains.
varnishadm ban req.url '~' '^/robots\.txt$'
Purge the homepage (all domains)
The homepage of all domains will be purged.
varnishadm ban req.url '~' '^/?$'
Purge a Domain
All pages on a specific domain will be purged.
varnishadm ban req.http.host '~' '^(www\.)?yourdomain\.com$'
List URLs with most Cache Misses
This will create a list of the URLs that caused the most cache misses the last hour.
varnishtop -p 3600 -i BereqURL
Press Q to exit this tool.
Configure Magento 2 for Varnish
We have made a script which configures the basic settings to use Varnish with Magento 2.
We recommend to test on a Staging account first.
Varnish CLI Tools
You can use these advanced Varnish CLI tools. We have configured them to know where to find your Varnish daemon. Most commands will work without commandline paramaters.