Hi,
I'm having an odd problem here. I'm trying to set up nginx with a varnish
proxy in front of it. The box is Ubuntu 15.10, nginx 1.9.3, varnish 4.0.3.
For testing I set up varnish on port 8080, and nginx was running on port 80
and 443. I shut down both, edit the config files so that varnish is
listening on port 80 and forwarding to the nginx backend on 8080. I do a
search and replace on all the listen directives in /etc/nginx/sites-enabled
to change listen 80 to listen 8080.
When I restart nginx, it comes up listening on port 8080 and 443 as
expected, but ALSO on port 80. This means varnish is unable to start up as
the port is already bound.
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
17514/nginx -g daem
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
17514/nginx -g daem
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
17514/nginx -g daem
I've checked through the nginx conf files many times. There are no other
listen 80 directives. I've also tried putting a server block in the main
nginx.conf with listen 8080 in it, but that doesn't help.
I think the problem may be that this system is confused between systemd and
init.d. I was having trouble with varnish in this respect. However I've
checked all the systemd files and none of them mention a port, and the
/etc/init.d/nginx file doesn't either.
Why is nginx using port 80? And how to stop it! Any pointers gratefully
received.
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,265791,265791#msg-265791