IPv4 & IPv6

Maxim Dounin mdounin at mdounin.ru
Fri Apr 5 21:43:31 UTC 2013


On Fri, Apr 05, 2013 at 04:17:09PM -0400, B.R. wrote:

> Hello,
> I noticed in an article dedicated to the subject
> (Fr)<http://blog.pastoutafait.org/billets/activer-le-support-ipv6-de-nginx>that
> to allow Nginx to listen both on IPv4 and IPv6 interfaces
> simultaneously, you needed to set sysctl with the following configuration
> (otherwise Nginx listening binds conflict one with each other):
> net.ipv6.bindv6only = 1
> However, this has conflicting and unwanted effects on other applications
> such as Java.
> Is there any other way to allow Nginx ot listen on both interface types
> without mandatory system configuration?

There is "ipv6only" parameter of the "listen" directive, which 
allows to listen on ipv6 and ipv4 sockets reliably and 
simulteniously regardless of the system configuration.  
Configuration like

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

will do the trick.

As of nginx 1.3.x, the ipv6only=on is used by default and there is 
no need to specify it explicitly.

See http://nginx.org/r/listen for more details.

Maxim Dounin

More information about the nginx mailing list