Varnish: VCL version declaration missing Update your VCL to Version 4 syntax

Today I installed latest version of varnish on a new server and configured it manually. I tried to start it but it was failing. So I did a configuration file test and it gave below error.

# varnishd -C -f /etc/varnish/default.vcl
Message from VCC-compiler:
VCL version declaration missing
Update your VCL to Version 4 syntax, and add
        vcl 4.0;
on the first line the VCL files.
('input' Line 1 Pos 1)
backend default {

Running VCC-compiler failed, exit 1

VCL compilation failed

If you read the error carefully then it says that the vcl-compiler requires additional line “vcl 4.0;” added at the top of the configuration file. This happened because Varnish 3.0 configuration syntax is not fully compatible with varnish 4.0. You will have to make a few simple changes to make it work.

vcl 4.0;
backend default {

So after adding the line. The varnish started running perfectly.

root@ [~]# /etc/init.d/varnish restart
Stopping Varnish Cache:                                    [  OK  ]
Starting Varnish Cache: 0
                                                           [  OK  ]
root@ [~]#


Sreejit is the founder of Server Management Plus. He has created a lots of automation scripts for the company using which we are able to resolve issue at an extremely fast rate and save lots of time. He has a very keen interest in new technologies and spend most of his free time online researching about it apart from listening music and watching movies.