IPv6 support

I have a VPS that using tunnelbroker service provided by HE.net, and I
can ‘wget -6’ to retrieve ipv6 sites’ content. Someone told me that he
cannot access my website served by nginx through IPv6 network, while
he can access the 22/tcp SSH port, and can ping6 my VPS. Is there any
compile option to enable IPv6 support?
My version is 0.6.32-3+lenny3 provied by debian, and nginx -V results:
~# nginx -V
nginx version: nginx/0.6.32
configure arguments: --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
–http-log-path=/var/log/nginx/access.log
–http-client-body-temp-path=/var/lib/nginx/body
–http-proxy-temp-path=/var/lib/nginx/proxy
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug
–with-http_stub_status_module --with-http_flv_module
–with-http_ssl_module --with-http_dav_module


Ren Xiaolei

On Mon, Feb 1, 2010 at 1:59 PM, 任晓磊 [email protected] wrote:

–pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock
–http-log-path=/var/log/nginx/access.log
–http-client-body-temp-path=/var/lib/nginx/body
–http-proxy-temp-path=/var/lib/nginx/proxy
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug
–with-http_stub_status_module --with-http_flv_module
–with-http_ssl_module --with-http_dav_module

–with-ipv6

and then set the appropriate configuration


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Thank you. I upgrade the deb package to 0.7.24 with ipv6 option. What
configuration should I set in nginx.conf ?

2010/2/1 Edho P Arief [email protected]:

–with-ipv6

and then set the appropriate configuration


Ren Xiaolei

The default “listen 80” doesn’t order nginx to listen on a IPv6
address. I cannot understand this.

At last, I use
listen [::]:80 default ipv6only=on;
listen 80;
to order nginx serve on ipv4 and ipv6.

A single “listen [::]:80;” makes it listen only on ipv6 address.

2010/2/1 任晓磊 [email protected]:

Thank you. I upgrade the deb package to 0.7.24 with ipv6 option. What
configuration should I set in nginx.conf ?


Ren Xiaolei

On Mon, Feb 1, 2010 at 2:18 PM, 任晓磊 [email protected] wrote:

Thank you. I upgrade the deb package to 0.7.24 with ipv6 option. What
configuration should I set in nginx.conf ?

listen [::]:80;

http://wiki.nginx.org/NginxHttpCoreModule#listen


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

On Mon, Feb 1, 2010 at 2:31 PM, 任晓磊 [email protected] wrote:

The default “listen 80” doesn’t order nginx to listen on a IPv6
address. I cannot understand this.

At last, I use
listen [::]:80 default ipv6only=on;
listen 80;
to order nginx serve on ipv4 and ipv6.

A single “listen [::]:80;” makes it listen only on ipv6 address.

yes, you need to specify both.

listen 80;
listen [::]:80;

is enough

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

2010/2/1 Edho P Arief [email protected]:

yes, you need to specify both.

listen 80;
listen [::]:80;
If I don’t specify “default ipv6only=on”, I would get

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: still could not bind()

How’s this going on?

Ren Xiaolei

Sorry for typo.

I set “listen 80; listen [::]:80;” , got “[emerg]: bind() to [::]:80
failed (98: Address already in use)”

I set " listen [::]:80; listen 80;", got “[emerg]: bind() to
0.0.0.0:80 failed (98: Address already in use)”

In one word, the later listen directive fails.

2010/2/1 任晓磊 [email protected]:


Ren Xiaolei


Ren Xiaolei

On Mon, Feb 1, 2010 at 2:41 PM, 任晓磊 [email protected] wrote:

Sorry for typo.

I set “listen  80; listen [::]:80;” , got “[emerg]: bind() to [::]:80
failed (98: Address already in use)”

I set " listen [::]:80; listen  80;", got “[emerg]: bind() to
0.0.0.0:80 failed (98: Address already in use)”

In one word, the later listen directive fails.

oh right. I forgot about behaviour difference between *bsd/solaris and
linux wrt ipv6 bind


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

任晓磊 at 2010-2-1 15:41 wrote:

Sorry for typo.

I set “listen 80; listen [::]:80;” , got “[emerg]: bind() to [::]:80
failed (98: Address already in use)”

I set " listen [::]:80; listen 80;", got "[emerg]: bind() to
0.0.0.0:80 failed (98: Address already in use)
Module ngx_http_core_module

“When Linux (in contrast to FreeBSD) binds IPv6 [::], it will also bind
the corresponding IPv4 address.”

In your box, I think ‘listen [::]:80;’ is enough.


Weibin Y.

2010/2/1 Weibin Y. [email protected]:

“When Linux (in contrast to FreeBSD) binds IPv6 [::], it will also bind the
corresponding IPv4 address.”

In your box, I think ‘listen [::]:80;’ is enough.
I tried this a moment ago, and netstat -an show only tcp6 socket. I
was just puzzled by tcp6, but not tried to access it from IPv4
network.
This time, I tried, and it indeed serve IPv4 AND IPv6.

Thank you all.


Ren Xiaolei