I have setup Varnish to run on port 80 which seems to work fine.

varnishd 8005 nobody    7u  IPv4  14055      0t0  TCP *:http (LISTEN)
varnishd 8005 nobody    8u  IPv6  14056      0t0  TCP *:http (LISTEN)

Under available sites in /etc/nginx I have the file default with:

server {
  listen 8080;


nginx: [emerg] bind() to failed (98: Address already in use)

Why is it still looking for port 80?

  • Chances are that one of the referenced files tries to use the default port. At a guess (since it has happened to me all to often), I'd start with /etc/nginx/conf.d/default.conf (which gets included by default from nginx.conf's include /etc/nginx/conf.d/*.conf; statement) – cyberx86 Nov 12 '12 at 10:42
up vote 2 down vote accepted

You should add

listen 8080 default;

And make sure that in other configuration files or virtualhosts there is no other default port 80.

  • I noticed I had another config file in the directory that had port 80, thanks – Stofke Nov 12 '12 at 10:58

You have a directive somewhere that is telling nginx to bind to port 80 find it and make the necessary change

cd /etc/nginx
grep -rw 80 *

Should get you looking in the right place.

  • I couldn't find it at first grepping it but when B14D3 send in his anwser it was clear to me where the error was. Sorry but I can only select one good answer. – Stofke Nov 12 '12 at 11:00

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.