← 返回命令列表

Linux command

varnishd 命令

趣味

复制后可按需替换文件名、目录或参数。

常用示例

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]

说明

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.

参数

-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.

FAQ

What is the varnishd command used for?

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.

How do I run a basic varnishd example?

Run `varnishd -a :80 -b localhost:8080` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a _address:port_ do in varnishd?

Listen for client requests (default port: 80).