I have installed varnish and fallowed the exact instruction for setting it up, however, it is not working as expected.
My /etc/default/varnish setup is:
DAEMON_OPTS="-a :80 \
-T localhost:1234 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
My /etc/varnish/default.vlc setup is
backend default {
.host = "localhost";
.port = "8080";
}
My apache port.conf setup is:
NameVirtualHost 127.0.0.1:8080
Listen 127.0.0.1:8080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
I am running ubuntu 15.04 with Apache 2.4.10. When I start varnish and check the process i get the fallowing:
0:00 /usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
Seems like neither of the Listen address or the Management interface work as set in /etc/varnish/default.vcl. None of my virtual machines work as a result. How can I solve this ?
Ok. Problem solved. First do
sudo grep -R 'ExecStart=/usr/sbin/varnishd' /etc/
so you can actually find the other place where daemon options for Varnish are set (in my case it was /etc/systemd/system/multi-user.target.wants/varnish.service). Open file in vim,nano or whatever and set "ExecStart" in that file as fallows:
-a :[same as /etc/default/varnish]80 -T localhost:[same as /etc/default/varnish]1234 -f [same as /etc/default/varnish ]/etc/varnish/default.vcl -S [same as /etc/default/varnish ]/etc/varnish/secret -s malloc,256m
Save and exit. After that do:
systemctl daemon-reload
systemctl restart varnish.service
And then we are done. Nothing like the official tutorial. Apparently it is old.
Full explanation of the problem here
You can change the varnish default port to 80 by using below steps:
sudo vim /lib/systemd/system/varnish.service
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T :6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
sudo systemctl daemon-reload
sudo service varnish restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With