varnish daemon not listening on configured port
Solution 1:
You need to change the varnish start parameters in the systemd service definition as well. You could edit the line starting with ExecStart
in the service defintion file:
sudo vi /lib/systemd/system/varnish.service
Modifying this file however, has the disadvantage that it will not be updated in future updates of the package. Alternatively, as suggested in the comments, you could create a systemd drop in file, which is the preferred way of adding settings to systemd definitions.
# create the drop in directory
sudo mkdir /etc/systemd/system/varnish.service.d
# create the drop in file. The name is irrelevant, as long as it ends in .conf
sudo vi /etc/systemd/system/varnish.service.d/mysettings.conf
Here you only need to add the settings you want do change, everything else will be loaded from the default definition file.
Example:
[Service]
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
This is the default line, change it as you need
Afterwards, tell systemctl to reload it's config files and to restart the service
sudo systemctl daemon-reload
sudo service varnish restart
Varnish should now listen on port 80.
Solution 2:
Note that the drop-in should have an empty ExecStart= Otherwise you will get an error starting the service (duplicate ExecStart)
sudo mkdir /etc/systemd/system/varnish.service.d
sudo nano /etc/systemd/system/varnish.service.d/varnishd.conf
With
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T <YOUR WEBSERVER IP>:8081 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m