varnishd

Varnish HTTP reverse proxy cache daemon

TLDR

Start with default backend
$ varnishd -a :80 -b localhost:8080
Start with VCL configuration
$ varnishd -a :80 -f /etc/varnish/default.vcl
Run in foreground
$ varnishd -F -a :80 -b localhost:8080
Set cache storage size
$ varnishd -a :80 -b localhost:8080 -s malloc,[256m]
Enable management interface
$ varnishd -a :80 -b localhost:8080 -T localhost:6082
Set default TTL
$ varnishd -a :80 -b localhost:8080 -t [120]
Set runtime parameters
$ varnishd -a :80 -b localhost:8080 -p thread_pools=[2]

SYNOPSIS

varnishd [options]

DESCRIPTION

varnishd is the Varnish HTTP accelerator daemon. It acts as a reverse proxy cache, accepting HTTP requests, forwarding them to backend servers, and caching responses to serve future requests faster.The daemon uses VCL (Varnish Configuration Language) to define caching policies, request routing, and response handling. VCL is compiled to C and loaded dynamically.Storage backends include malloc (memory) and file (disk-based with memory mapping). Multiple storage backends and listening addresses can be configured.The management interface allows runtime configuration changes, VCL loading, and statistics access via varnishadm.

PARAMETERS

-a address[:port]

Listen for client requests (default port: 80).
-b host[:port]
Backend server (default port: 80).
-f config
VCL configuration file.
-F
Run in foreground (don't fork).
-s [name=]type[,options]
Storage backend: malloc, file, persistent.
-t ttl
Default TTL for cached objects in seconds.
-T address[:port]
Management interface address.
-S secret-file
Authentication secret for management.
-n name
Instance name and working directory.
-p param=value
Set runtime parameter.
-r param[,param...]
Make parameters read-only.
-i identity
Server identity string.
-I clifile
Execute CLI commands from file on start.
-d
Enable debug mode (do not start worker process, accept CLI commands on stdin).
-j jail[,jailoptions]
Specify jailing technology for worker process.

INSTALL

sudo apt install varnish
sudo dnf install varnish
sudo apk add varnish
brew install varnish
nix profile install nixpkgs#varnish

CAVEATS

Requires either -b or -f option. VCL changes require reload through management interface. Memory storage is lost on restart. Running on port 80 requires root or capabilities.

HISTORY

Varnish was created by Poul-Henning Kamp and released in 2006. It was designed from scratch for modern hardware and operating systems, using techniques like memory-mapped files and kernel-level optimizations. It has become one of the most widely deployed HTTP accelerators.

SEE ALSO

varnishlog(1), varnishstat(1), nginx(8)