Skip to content

Instantly share code, notes, and snippets.

@mauricios
Last active October 14, 2017 01:09
Show Gist options
  • Save mauricios/696b5fe8f8817e4b4946d616516586ce to your computer and use it in GitHub Desktop.
Save mauricios/696b5fe8f8817e4b4946d616516586ce to your computer and use it in GitHub Desktop.
Varnish useful commands
#!/bin/sh
# Check configuration file
sudo varnishd -C -f /path/to/default.vcl -p vcl_dir=/path/to/vcl_dir
# Ban/Purge a URL
sudo varnishadm "ban req.http.host ~ ^<hostname>$ && req.url ~ ^<url>$"
# Change configuration
## Show list of configurations
sudo varnishadm "vcl.list"
## Show configuration
sudo varnishadm "vcl.show <config>"
## Load new configuration
sudo varnishadm "vcl.load <config> default.vcl"
## Verify new configuration
sudo varnishadm "vcl.show <config>"
## Use new configuration
sudo varnishadm "vcl.use <config>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment