Varnish on port 80 – Debian Stretch

Changing the /etc/default/varnish file to change the listening port doesn’t seem to work,
Varnish keeps running on port 6081. Unless configured as shown below:

apt-get update
apt-get install apache2
apt-get install varnish

Change the Apache listening port to 8080:

sed -i ‘s/Listen 80/Listen 8080/g’ /etc/apache2/ports.conf

Make Varnish listen on port 80:

sed -i ‘s/6081/80/g’ /lib/systemd/system/varnish.service

Restart services:

service varnish restart
service apache2 reload

Result

netstat -pltn | grep -e varnish -e apache
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7498/varnishd
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 7497/varnishd
tcp6 0 0 :::80 :::* LISTEN 7498/varnishd
tcp6 0 0 :::8080 :::* LISTEN 1940/apache2
tcp6 0 0 ::1:6082 :::* LISTEN 7497/varnishd

Package: varnish
Version: 4.0.2-1