ipv4 & ipv6 Virtual Hosting - address in use
Maxim Dounin
mdounin at mdounin.ru
Mon Dec 27 20:07:12 MSK 2010
Hello!
On Mon, Dec 27, 2010 at 10:55:35AM -0500, petteyg359 wrote:
> Linux 2.6.34-gentoo-r12 x86_64 Intel(R) Core(TM) i7 CPU 930 @ 2.80GHz
> GenuineIntel GNU/Linux
> # nginx -V
> nginx version: nginx/0.8.53
> TLS SNI support enabled
> configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx
> --conf-path=/etc/nginx/nginx.conf
> --error-log-path=/var/log/nginx/error_log --pid-path=/var/run/nginx.pid
> --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx
> --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib
> --http-log-path=/var/log/nginx/access_log
> --http-client-body-temp-path=/var/tmp/nginx/client
> --http-proxy-temp-path=/var/tmp/nginx/proxy
> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
> --http-scgi-temp-path=/var/tmp/nginx/scgi
> --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-ipv6 --with-pcre
> --without-http_autoindex_module --without-http_browser_module
> --without-http_charset_module --without-http_geo_module
> --without-http_map_module --without-http_memcached_module
> --without-http_referer_module --without-http_ssi_module
> --without-http_split_clients_module --without-http_userid_module
> --with-http_realip_module --with-http_ssl_module
> --without-mail_imap_module --without-mail_pop3_module
> --without-mail_smtp_module
>
> server {
> listen [::]:80 default_server;
> listen 80 default_server;
> return 444;
> }
> #According to docs, this config should fail, because without
> ipv6only=on,
> #this line should automatically listen on ipv4 interfaces also.
This shouldn't fail as long as you have ipv6-only bind as
default in your system. It won't even fail on OSes where binds on
ipv6 with ipv4 doesn't conflict with ipv4 explicit binds. This is
unrelated though.
> # netstat -lp | grep nginx
> tcp 0 0 *:http *:*
> LISTEN 31704/nginx.conf
> tcp6 0 0 [::]:http [::]:*
> LISTEN 31704/nginx.conf
>
> server {
> listen [::]:80 default_server ipv6only=on;
> return 444;
> }
> #I remove the listen 80 line, and add ipv6only=on
> # /etc/init.d/nginx start
> * Checking nginx' configuration ...
> the configuration file /etc/nginx/nginx.conf syntax is ok
> configuration file /etc/nginx/nginx.conf test is successful
>
> [ ok ]
> * Starting nginx ...
> [emerg]: bind() to [2a01:4f8:130:9101::3]:80 failed (98: Address already
> in use)
> [emerg]: bind() to [2a01:4f8:130:9101::3]:80 failed (98: Address already
> in use)
> [emerg]: bind() to [2a01:4f8:130:9101::3]:80 failed (98: Address already
> in use)
> [emerg]: bind() to [2a01:4f8:130:9101::3]:80 failed (98: Address already
> in use)
> [emerg]: bind() to [2a01:4f8:130:9101::3]:80 failed (98: Address already
> in use)
> [emerg]: still could not bind()
> * start-stop-daemon: failed to start `/usr/sbin/nginx'
> * Failed to start nginx
>
> [ !! ]
> * ERROR: nginx failed to start
>
> Not only does it not work as described, it seems to be trying to bind a
> specific address multiple times, and maybe succeeding the first time,
> because there's nothing else running on any interface port 80, so it
> fails since it can't successfully bind the same address a second time.
Could you please provide *full config* which triggers the problem?
In particular, full list of server{} blocks with their "listen"
directives.
Maxim Dounin
More information about the nginx
mailing list