IPv6 support

Igor Sysoev is at rambler-co.ru
Wed Apr 22 22:27:14 MSD 2009


On Wed, Apr 22, 2009 at 02:12:15PM -0400, r wrote:

> Hello,
> 
> Thanks for the quick answer. 
> 
> Well, I'm sure nothing is running on those port (except the same nginx on the IPv4 address with a "listen 80" entry). But you managed to make me find the real bug!
> 
> I made two configuration files with the same entries but each one has different listen entries (so i have a nginx.conf-ipv4 and nginx.conf-ipv6).
> 
> # nginx -c nginx.conf-ipv4
> # netstat -punta | grep :443
> tcp        0      0 0.0.0.0:443         0.0.0.0:*               LISTEN      9810/nginx.conf-ipv4
> # nginx -c nginx.conf-ipv6
> # netstat -punta | grep :443
> tcp        0      0 0.0.0.0:443         0.0.0.0:*               LISTEN      9810/nginx.conf-ipv4
> # tail /var/log/nginx/error.log
> ...
> 2009/04/22 19:54:51  9715#0: bind() to [::]:443 failed (98: )
> 2009/04/22 19:54:51  9715#0: still could not bind()
> # (i kill nginx both nginx processes)
> # netstat -punta | grep :443
> (returns nothing)
> # nginx -c nginx.conf-ipv6
> # netstat -punta | grep :443
> tcp6       0      0 :::443                  :::*                    LISTEN      9765/nginx.conf-ipv6
> # nginx -c nginx.conf-ipv4
> # netstat -punta | grep :443
> tcp6       0      0 :::443                  :::*                    LISTEN      9765/nginx.conf-ipv6
> # tail /var/log/nginx/error.log
> ...
> 2009/04/22 20:03:14  10207#0: bind() to 94.23.8.133:443 failed (98: )
> 2009/04/22 20:03:14  10207#0: still could not bind()
> 
> So, it works, but impossible to have two listen entries with both ipv4 and ipv6 (like the one in the post you made in february).
> 
> I'm running Debian GNU/Linux 5.0 (lenny).

It seems in Linux [::]:443 listens on both IPv6 and IPv4 addresses.
You may test this by making a request to IPv4 address, it should work.

If you want to set two listen sockets, then you need

   listen [::]:443  default ipv6only=on;
   listen [::]:80;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list