- Varnish Command Line Interface·续
- param.reset [-j] #
- param.set [-j] #
- param.show [-l|-j] [|changed]#
- pid [-j]#
- ping [-j] []#
- quit#
- start#
- status [-j]#
- stop#
- storage.list [-j]#
- tls.cert.commit#
- tls.cert.discard #
- tls.cert.list [-s]#
- tls.cert.load [cert-id] [-f frontend-name] [-k private-key-filename] [-p protos] [-c ciphers] [-s ci‐pher-suites] [-o] [-d]#
- tls.cert.reload#
- tls.cert.rollback#
- vcl.deps [-j]#
- vcl.discard <name_pattern>…#
- vcl.inline <quoted_VCLstring> [auto|cold|warm]#
- vcl.label #
- vcl.list [-j]#
- vcl.load [auto|cold|warm]#
- vcl.show [-v] []#
- vcl.state auto|cold|warm#
- vcl.symtab#
- vcl.use <configname|label>#
- Backend Pattern#
- Ban Expressions#
- VCL Temperature#
- Examples#
- Authors#
- See also#
Varnish Command Line Interface·续
Return the last panic, if any.
-j specifies JSON output – the panic message is returned as an unstructured JSON string.
param.reset [-j] #
Reset parameter to default value.
The JSON output is the same as param.show -j <param> and contains the updated value as it would be represented by a subsequent execution of param.show.
param.set [-j] #
Set parameter value.
The JSON output is the same as param.show -j <param> and contains the updated value as it would be represented by a subsequent execution of param.show.
This can be useful to later verify that a parameter value didn’t change and to use the value from the JSON output to reset the parameter to the desired value.
param.show [-l|-j] [|changed]#
Show parameters and their values.
The long form with -l shows additional information, including documentation and minimum, maximum and default values, if defined for the parameter. JSON output is specified with -j, in which the information for the long form is included; only one of -l or -j is permitted. If a parameter is specified with <param>, show only that parameter. If changed is specified, show only those parameters whose values differ from their defaults.
pid [-j]#
Show the pid of the master process, and the worker if it’s running.
-j specifies JSON output.
ping [-j] []#
Keep connection alive.
The response is formatted as JSON if -j is specified.
quit#
Close connection.
start#
Start the Varnish cache process.
status [-j]#
Check status of Varnish cache process.
-j specifies JSON output.
stop#
Stop the Varnish cache process.
storage.list [-j]#
List storage devices.
-j specifies JSON output.
tls.cert.commit#
Commit TLS configuration changes (loaded and/or discarded certs).
tls.cert.discard #
Discard TLS certificate. Ongoing sessions will be allowed to complete.
tls.cert.list [-s]#
List active TLS configurations. Takes an optional -s that will only list staged or discarded certificates.
tls.cert.load [cert-id] [-f frontend-name] [-k private-key-filename] [-p protos] [-c ciphers] [-s ci‐pher-suites] [-o] [-d]#
Load TLS certificate from the given file. If a frontend is specified the certificate will only be valid for that frontend.
-f specifies the frontend to load the certificate for.
-k specifies a separate private key file.
-p specifies the SSL/TLS protocols to be used. Example: -p TLSv1.2,TLSv1.3
-c specifies the TLS1.2 (and earlier) cipher list.
-s specifies the TLS1.3 ciphersuites.
-d will flag the certificate as default fallback certificate.
-o Prefer the server’s cipher order over the client’s.
tls.cert.reload#
Atomically reload all certificates. A successful reload is immediately committed. Each active certificate will be reread from disk and loaded using the same parameters as the current configuration. If an error is encountered during a reload, all changes will be rolled back and the previous state will be preserved.
NOTE: A reload cannot take place while there are uncommitted changes to the TLS configuration.
tls.cert.rollback#
Clear TLS commands staged for commit. This is the inverse of commit.
vcl.deps [-j]#
List all loaded configuration and their dependencies.
Unless -j is specified for JSON output, the output format is up to two columns of dynamic width separated by white space with the fields:
- VCL: a VCL program
- Dependency: another VCL program it depends on
Only direct dependencies are listed, and VCLs with multiple dependencies are listed multiple times.
vcl.discard <name_pattern>…#
Unload the named configurations (when possible).
Unload the named configurations and labels matching at least one name pattern. All matching configurations and labels are discarded in the correct order with respect to potential dependencies. If one configuration or label could not be discarded because one of its dependencies would remain, nothing is discarded. Each individual name pattern must match at least one named configuration or label.
vcl.inline <quoted_VCLstring> [auto|cold|warm]#
Compile and load the VCL data under the name provided.
Multi-line VCL can be input using the here document Syntax.
vcl.label #
Apply label to configuration.
A VCL label is like a UNIX symbolic link, a name without substance, which points to another VCL.
Labels are mandatory whenever one VCL references another.
vcl.list [-j]#
List all loaded configuration.
Unless -j is specified for JSON output, the output format is five or seven columns of dynamic width, separated by white space with the fields:
- status: active, available or discarded
- state: label, cold, warm, or auto
- temperature: init, cold, warm, busy or cooling
- busy: number of references to this vcl (integer)
- name: the name given to this vcl or label
- [
<-|->] and label info last two fields)->: label “points to” the named<-( label[s]): the vcl has label(s)
vcl.load [auto|cold|warm]#
Compile and load the VCL file under the name provided.
vcl.show [-v] []#
Display the source code for the specified configuration.
vcl.state auto|cold|warm#
Force the state of the named configuration.
vcl.symtab#
Dump the VCL symbol-tables.
vcl.use <configname|label>#
Switch to the named configuration immediately.
Backend Pattern#
A backend pattern can be a backend name or a combination of a VCL name and backend name in “VCL.backend” format. If the VCL name is omitted, the active VCL is assumed. Partial matching on the backend and VCL names is supported using shell-style wildcards, e.g. asterisk (*).
Examples:
backend.list def*
backend.list b*.def*
backend.set_health default sick
backend.set_health def* healthy
backend.set_health * auto
Ban Expressions#
A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with “&&”.
A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie.
Operators are “==” for direct comparison, “~” for a regular expression match, and “>” or “<” for size comparisons. Prepending an operator with “!” negates the expression.
The argument could be a quoted string, a regexp, or an integer. Integers can have “KB”, “MB”, “GB” or “TB” appended for size related fields.
VCL Temperature#
A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over.
Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can’t escape that. However, most of the time you want to pay the price only for the active VCL and keep older VCLs in case you’d need to rollback to a previous version.
The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it.
Examples#
Load a multi-line VCL using shell-style here document :
vcl.inline example << EOF
vcl 4.0;
backend www {
.host = "127.0.0.1";
.port = "8080";
}
EOF
Ban all requests where req.url exactly matches the string /news:
ban req.url == "/news"
Ban all documents where the serving host is “example.com” or “www.example.com”, and where the Set-Cookie header received from the backend contains “USERID=1663”:
ban req.http.host ~ "^(?i)(www\\.)?example\\.com$" && obj.http.set-cookie ~ "USERID=1663"
Authors#
This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning Kamp.
