Skip to content

Instantly share code, notes, and snippets.

@cedricmagne
Last active November 29, 2020 19:43
Show Gist options
  • Save cedricmagne/1356414540a56499c72a to your computer and use it in GitHub Desktop.
Save cedricmagne/1356414540a56499c72a to your computer and use it in GitHub Desktop.
Command to run Varnish on mac OS X
# must run as root
sudo varnishd -f /usr/local/etc/varnish/default.vcl -s file -a 127.0.0.1:80
# help: see available arguments with descriptions
varnishd -h
# -f Specifies the location of the vcl script to launch Varnish with.
# -s Specifies storage options. The file argument stores in /tmp by default. You can specify another location with -s file,/location
# -a Specifies the address and port that Varnish will run at. You can access your website through Varnish using this address and port.
# Kill varnish
sudo pkill varnishd
# Start Varnish with flush cached objects
sudo varnishd -f /usr/local/etc/varnish/default.vcl -s file -a 127.0.0.1:80 -T 127.0.0.1:6082
# If you'd prefer not to wipe your cache when reloading your VCL, instead use:
varnishadm "vcl.load default /usr/local/etc/varnish/default.vcl"
varnishadm "vcl.use default"
# Look at an incoming client request of a specific URL:
varnishlog -c -m RxURL:"/"
# Look at a a backend request of a specific URL:
varnishlog -b -m TxURL:"/"
# See requests for one specific Hostname:
varnishlog -c -m RxHeader:"Host: hostname.org"
# See the age of the cache objects for a specific hostname:
varnishlog -c -m RxHeader:"Host: hostname.org" | grep Age
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment