HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=4)
-   -   Nginx bind to :80 failed, address already in use (http://www.howtoforge.com/forums/showthread.php?t=61239)

msp 31st March 2013 14:49

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!

markc 31st March 2013 15:59

This may be completely unrelated but perhaps you have overlapping listen directives...
Code:

grep -r listen /etc/nginx/*

msp 31st March 2013 18:48

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?

markc 31st March 2013 19:23

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;

msp 31st March 2013 20:28

Quote:

Originally Posted by markc (Post 295094)
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?

markc 31st March 2013 20:33

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.


All times are GMT +2. The time now is 03:49.

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