Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 31st March 2013, 15:49
msp msp is offline
Member
 
Join Date: Aug 2011
Posts: 41
Thanks: 2
Thanked 2 Times in 2 Posts
Default Nginx bind to :80 failed, address already in use

I think this is unrelated to my other post from a few minutes ago.

When I install and start Nginx as part of ISPConfig3 setup, I get:

Code:
Starting nginx: nginxnginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
netstat -tap gives:

Code:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:imaps                 *:*                     LISTEN      2355/dovecot
tcp        0      0 *:pop3s                 *:*                     LISTEN      2355/dovecot
tcp        0      0 localhost.localdom:9000 *:*                     LISTEN      7230/php-fpm.conf)
tcp        0      0 localhost.localdo:10024 *:*                     LISTEN      2136/amavisd (maste
tcp        0      0 *:43113                 *:*                     LISTEN      1522/rpc.statd
tcp        0      0 *:mysql                 *:*                     LISTEN      2102/mysqld
tcp        0      0 *:pop3                  *:*                     LISTEN      2355/dovecot
tcp        0      0 *:imap2                 *:*                     LISTEN      2355/dovecot
tcp        0      0 *:sunrpc                *:*                     LISTEN      1510/portmap
tcp        0      0 *:ssh                   *:*                     LISTEN      1804/sshd
tcp        0      0 *:smtp                  *:*                     LISTEN      2344/master
tcp        0    248 doris.insistendo.co:ssh b0fa9154.bb.sky.c:50711 ESTABLISHED 2394/0
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      1804/sshd
Halp!
Reply With Quote
Sponsored Links
  #2  
Old 31st March 2013, 16:59
markc markc is offline
Member
 
Join Date: Dec 2012
Posts: 57
Thanks: 6
Thanked 9 Times in 9 Posts
Default

This may be completely unrelated but perhaps you have overlapping listen directives...
Code:
grep -r listen /etc/nginx/*
Reply With Quote
  #3  
Old 31st March 2013, 19:48
msp msp is offline
Member
 
Join Date: Aug 2011
Posts: 41
Thanks: 2
Thanked 2 Times in 2 Posts
Default

The output of that command is:

Code:
/etc/nginx/nginx.conf:#         listen     localhost:110;
/etc/nginx/nginx.conf:#         listen     localhost:143;
/etc/nginx/sites-available/default:     listen 80;
/etc/nginx/sites-available/default:     listen [::]:80 default_server;
/etc/nginx/sites-available/default:     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
/etc/nginx/sites-available/default:#    listen 8000;
/etc/nginx/sites-available/default:#    listen somename:8080;
/etc/nginx/sites-available/default:#    listen 443;
/etc/nginx/sites-enabled/default:       listen 80;
/etc/nginx/sites-enabled/default:       listen [::]:80 default_server;
/etc/nginx/sites-enabled/default:       # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
/etc/nginx/sites-enabled/default:#      listen 8000;
/etc/nginx/sites-enabled/default:#      listen somename:8080;
/etc/nginx/sites-enabled/default:#      listen 443;
Third line shows Nginx is set to listen on localhost port 80, right?
Reply With Quote
  #4  
Old 31st March 2013, 20:23
markc markc is offline
Member
 
Join Date: Dec 2012
Posts: 57
Thanks: 6
Thanked 9 Times in 9 Posts
Default

See if either of these makes a difference...

/etc/nginx/sites-enabled/default:# listen [::]:80 default_server;
/etc/nginx/sites-enabled/default: listen [::]:80 default_server ipv6_only=on;
Reply With Quote
  #5  
Old 31st March 2013, 21:28
msp msp is offline
Member
 
Join Date: Aug 2011
Posts: 41
Thanks: 2
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by markc View Post
See if either of these makes a difference...

/etc/nginx/sites-enabled/default:# listen [::]:80 default_server;
/etc/nginx/sites-enabled/default: listen [::]:80 default_server ipv6_only=on;
So I edited /etc/nginx/sites-enabled/default and commented-out the line

Code:
listen [::]:80 default_server;
And then restarted nginx. This time it didn't return the error, but said "nginx is running."

I'm guessing this was me telling nginx to stop listening on the IPv6 port?
Reply With Quote
  #6  
Old 31st March 2013, 21:33
markc markc is offline
Member
 
Join Date: Dec 2012
Posts: 57
Thanks: 6
Thanked 9 Times in 9 Posts
 
Default

Maybe it needs to be this to tell this 2nd listen statement to be ipv6 only...

listen [::]:80 default_server ipv6_only=on;

or, just leave it commented out if you are not going to be using ipv6 at all.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SASL LOGIN authentication failed Captain Installation/Configuration 4 13th March 2012 21:07
Fail2ban configuration Captain Installation/Configuration 2 28th June 2011 20:48
monitrc configuration for Debian ISPConfig 3 server Hans Tips/Tricks/Mods 2 28th March 2011 00:22
Monitoring server Ubuntu wiss Installation/Configuration 7 20th November 2010 13:56
Sending emails with custom FROM email address merisor Installation/Configuration 4 8th February 2010 17:27


All times are GMT +2. The time now is 11:00.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.