Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
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 0.0.0.0:80 failed (98: Address already in use)

Why is it still looking for port 80?

share|improve this question
    
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

2 Answers 2

up vote 0 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.

share|improve this answer
    
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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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