Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to check varnish configuration syntax without actually using the new version?

I'm searching for a native varnish equivalent of apache2ctl configtest

share|improve this question
up vote 3 down vote accepted

You can ask Varnish to compile your VLC file to a temporary file. This is part of our script that loads a new configuration into our varnish servers:

trap 'rm -f $tmpfile' 0
varnishd -C -f /srv/web/fe/varnish/default.vcl > $tmpfile

if [ ! -s $tmpfile ]; then
    echo "ERROR: There are errors in the varnish configuration." >&2
    exit 1

This works because varnishd -C will not generate any output on stdout if there are errors in the VCL.

share|improve this answer

What's about varnish_reload_vcl?

Some examples:

  1. Without problems in your VCL file

    $ varnish_reload_vcl
    Loading vcl from /etc/varnish/default.vcl
    Current running config name is reload_2016-01-28T15:18:23
    Using new config name reload_2016-01-28T15:19:57
    VCL compiled.
    VCL 'reload_2016-01-28T15:19:57' now active
    available       0 boot
    available       0 reload_2016-01-28T14:40:04
    available       0 reload_2016-01-28T14:42:07
    available       0 reload_2016-01-28T14:42:32
    available       0 reload_2016-01-28T14:47:45
    available       0 reload_2016-01-28T14:48:45
    available       0 reload_2016-01-28T14:50:26
    available       0 reload_2016-01-28T14:55:55
    available       0 reload_2016-01-28T15:18:23
    active          0 reload_2016-01-28T15:19:57
  2. With an error in your VCL file

    $ varnish_reload_vcl
    Loading vcl from /etc/varnish/default.vcl
    Current running config name is reload_2016-01-28T15:19:57
    Using new config name reload_2016-01-28T15:21:51
    Message from VCC-compiler:
    Symbol not found: 'b1' (expected type BACKEND):
    ('input' Line 77 Pos 32)
            set req.backend_hint = b1;
    Running VCC-compiler failed, exited with 2
    VCL compilation failed
    Command failed with error code 106
    varnishadm -S /etc/varnish/secret -T vcl.load failed
share|improve this answer
I do not have this command. How can I install it? +1 anyway, looks good :) – greg0ire Jan 28 at 17:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.