Installing Varnish as per the Varnish Book?

92 views Asked by At

I have a vanilla Debian DigitalOcean machine and I'm trying to follow the 'developer' course in the Varnish Book. I've got to the first exercise, Installation.

I've installed Apache and got it running on port 8080 (if I go to http://my.ip.xxx.xxx:8080 I see the Apache2 Debian default page. I've also installed Varnish, so steps 1-3 are fine.

Now I'm trying to follow steps 4 and 5. I've edited /etc/default/varnish as follows:

DAEMON_OPTS="-a :80 \
         -T localhost:1234 \
         -f /etc/varnish/default.vcl \
         -S /etc/varnish/secret \
         -s malloc,256m"

And I've edited /etc/varnish/default.vcl as follows:

backend default {
   .host = "localhost";
   .port = "8080";
}

Then I've run service varnish start, which produces no errors.

But if I go to http://my.ip.xxx.xxx (i.e. with no port number) I just see nothing.

What am I doing wrong?

If I run netstat -ntlp as suggested in the book, I see Varnish on ports 6081 and 6082, and Apache on port 8080, but nothing on port 80.

1

There are 1 answers

0
Angel Abad Cerdeira On

Old question but had this problem myself. In my case I had to edit /lib/systemd/system/varnishncsa.service as SystemD was taking over the legacy InitD.

[Service]
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:1234 -f /etc/varnish/abadcer.vcl -S /etc/varnish/secret -s malloc,256m

Then you commit the changes and restart Varnish

sudo systemctl daemon-reload
sudo service varnish restart