Forum: NGINX How to bind nginx to ipv4 and ipv6 interface ?

Posted by hristoc (Guest)
on 2012-11-26 22:51
(Received via mailing list)
Hello,
any one can tell me what is wrong on my nginx 1.2.5 version compied with
ipv6 suppot ? I try to start nginx on both ipv4 and ipv6. I read on 
internet
if I put in my config file: listen [::]:80; is enought and nginx will 
bind
on both ipv4 and ipv6 interfaces or even if I compile nginx with ipv6
support is enought and on listen 80; will bind to ip4 and ip6, but i 
receive
follow error:

[emerg] 15728#0: bind() to [::]:80 failed (98: Address already in use


Any hints how to start nginx on both intefaces ?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,233246,233246#msg-233246
Posted by hristoc (Guest)
on 2012-12-19 19:26
(Received via mailing list)
Posted by Steve Holdoway (Guest)
on 2012-12-19 19:32
(Received via mailing list)
Multiple listen statements
Posted by Igor Sysoev (Guest)
on 2012-12-19 20:02
(Received via mailing list)
On Nov 27, 2012, at 1:50 , hristoc wrote:

>
> Any hints how to start nginx on both intefaces ?

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


--
Igor Sysoev
http://nginx.com/support.html
Posted by Lukas Tribus (Guest)
on 2012-12-20 09:29
(Received via mailing list)
> 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:
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.