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

Whenever I try to start nginx I get the following output.

/etc/init.d/nginx start
Starting nginx: [emerg]: bind() to [::]:80 failed (98: Address already in use)
[emerg]: bind() to [::]:80 failed (98: Address already in use)
[emerg]: bind() to [::]:80 failed (98: Address already in use)
[emerg]: bind() to [::]:80 failed (98: Address already in use)
[emerg]: bind() to [::]:80 failed (98: Address already in use)
[emerg]: still could not bind()
nginx.

However, nothing is listening on port 80. I get nothing when I run lsof -i :80

I'm also running php-fpm which I thought might have something to do with it but as I said, lsof doesn't indicate that php-fpm is related.

Does anyone have any idea what to look for?

share|improve this question
    
What does netstat -tanp show? What do you get if you telnet to port 80? –  David Jul 11 '11 at 3:13
    
Nothing for port 80 in netstat or telnet. –  Darrell Brogdon Jul 11 '11 at 3:23
    
Can you post your config? –  David Jul 11 '11 at 3:26

4 Answers 4

Try starting nginx manually at the command line and see if you have the same problem. Try it with a clean config file and slowly add your changes. Maybe it's as simple as a configuration issue.

share|improve this answer

Pretty obvious, but you never know: are you starting this as root or via sudo? Only root can bind to ports < 1024.

share|improve this answer
    
Trying to bind to a privileged port as a non-root user gives EACCES, not EADDRINUSE. –  womble Jul 11 '11 at 6:25

Turns out it was a problem with the config file. Kind-of disturbed that a config file problem reports as an unrelated inability to bind to a port.

share|improve this answer
6  
What kind of a problem? Can you please post what options in your config file were causing such behaviour? –  Alexander Azarov Jul 11 '11 at 9:13

My guess is that Apache is taking it. I'm pretty sure that PHP cannot run without it. I'm not very confident with PHP config. Here's a link that I found that may help. http://www.howtoforge.com/nginx_php5_fast_cgi_xcache_ubuntu7.04

I hope that this helps a little.

share|improve this answer
    
-1 No, PHP does not require Apache and that link has nothing to do with PHP requiring Apache, or even using Apache... –  Chris S Jul 12 '11 at 12:39

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.