How to bind nginx to ipv4 and ipv6 interface ?

Lukas Tribus luky-37 at hotmail.com
Thu Dec 20 08:29:17 UTC 2012


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

Remember that ipv6only is a socket option, and you can specify a socket option
only once per address:port pair:
> A listen directive can have several additional parameters specific to
> socket-related system calls. They can be specified in any listen
> directive, but only once for the given address:port pair.


So your config needs to look this way, if you have multiple server statements in your config:
> server {
> 	listen 80;
> 	listen [::]:80 ipv6only=on;
> 	[...]
> }
> server {
> 	listen 80;
> 	listen [::]:80;
> 	[...]
> }
> server {
> 	listen 80;
> 	listen [::]:80;
> 	[...]
> }

 		 	   		  


More information about the nginx mailing list