Score:0

As of this morning varnish is not listening on configured port 80

ca flag

I've had varnish running on my site for awhile now configured to listen on port 80 and apache on port 8080. This morning I noticed that varnish is now listening on port 6081. When I systemctl restart varnish it still is listening on port 6081.

ps aux | grep varnish

vcache    1010  0.0  0.0  18524 11620 ?        SLs  14:39   0:00 /usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
vcache    1023  0.0  0.0 286156 68660 ?        SLl  14:39   0:00 /usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
root      2248  0.0  0.0   3084   896 pts/0    S+   14:53   0:00 grep varnish
varnish+  4593  0.1  0.0  86596  1144 ?        Ss   06:57   0:32 /usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -D -P /run/varnishncsa/varnishncsa.pid

/etc/default/varnish

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,48G"

How can I get varnish to listen on the configured port and also find out why this happened?

Update

This answer solved the issue. I had to modify /etc/systemd/system/multi-user.target.wants/varnish.service. But now my question is why? Not exactly sure what this file is or why it had port 6081 in it.

Cameron Kerr avatar
id flag
So what do you get when you run 'systemctl cat varnish.service'? As root, if you 'lsof -Pni:80 | grep LISTEN', do you see any other process running on port 80? Is Apache httpd still listening on port 8080?
Timothy Fisher avatar
ca flag
After modifying the user.target.wants file when I run `systemctl cat varnish.service` i get: `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` and also `WantedBy=multi-user.target`. And yes when running the lsof command I only have varnish listening on port 80 and apache on port 8080. So the issue is fixed now, just wondering why I had to modify that user.target.wants file.
Thijs Feryn avatar
in flag
@TimothyFisher `/etc/default/varnish` is the old way, the pre-systemd way. Have you performed any OS upgrades recently that could have prioritized systemd over the old sysv config files? FYI: `sudo systemctl edit --full varnish` will allow you to see the full service file and `sudo systemctl edit varnish` will present potential overrides.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.