When we have installed Varnish on your hosting account, you can use these tools to manage Varnish.
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 Configuration File
When the Varnish server starts or restarts, it loads the VCL file located at:
If you don't use our script to configure Magento 2, make sure this script contains the right VCL.
Inside this default VCL file you can also point to the Magento 1 VCL using an "include".
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.
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.