Re:

When running two vhosts, one of which listens on [::], the other on localhost,
nginx will fail with this error:
2011/06/01 10:12:35 [emerg] 9750#0: bind() to 127.0.0.1:80 failed (98: Address
already in use)
My understanding was that this error stems from [::] being inclusive of
127.0.0.1, causing nginx to attempt to bind it twice.
However, replacing the listen localhost; with listen [::1]; removes the
error, despite the fact that [::1] is also included within [::].

I think you ran into the issue of linux binding to both ipv6 and ipv4 by
default.
http://wiki.nginx.org/HttpCoreModule#listen
you probably want to use
listen [::] ipv6only=on;

V/r,
Rob

Yes, except that I want it to bind to both v4 and v6 for those site.
My question was why the [::] causes it to fail to bind to 127.0.0.1, but
works just fine with [::1], when the [::] should be binding to both of
those in exactly the same way?


Les A.
lesaker.org

On Thu, Jun 2, 2011 at 5:05 AM, Les A. [email protected] wrote:

Yes, except that I want it to bind to both v4 and v6 for those site.
My question was why the [::] causes it to fail to bind to 127.0.0.1, but works
just fine with [::1], when the [::] should be binding to both of those in exactly
the same way?

My wild guess would be because it went like this:

  • nginx lookup localhost
  • found two entries; ::1 and 127.0.0.1
  • nginx bind to ::1
  • linux’s behavior caused binding to ::1 also binds to 127.0.0.1
  • nginx bind to 127.0.0.1
  • already bind from previous ::1, reporting error

Hello!

On Thu, Jun 02, 2011 at 09:33:49AM +0700, Edho P Arief wrote:

  • linux’s behavior caused binding to ::1 also binds to 127.0.0.1
  • nginx bind to 127.0.0.1
  • already bind from previous ::1, reporting error

No.

Maxim D.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs