# Nginx 1.4 problem

**URL:** <https://www.ruby-forum.com/t/nginx-1-4-problem/228650>\
**Category:** NGINX\
**Created:** [May 1, 2013, 7:14pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650 "2013-05-01T19:14:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 7:14pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/1 "2013-05-01T19:14:25Z")

</div>

Tried to upgrade to just-released Nginx1.4. TCP 3-way hand-shake  
aborted by server’s ACK+RST packet, but netstat shows server  
is listening on that port. Any config has been changed since Nginx 1.2  
to 1.4 in this regard?  
Thanks,

- Alder

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 7:40pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/2 "2013-05-01T19:40:44Z")

</div>

Hello!

On Wed, May 01, 2013 at 10:13:34AM -0700, Alder N. wrote:

> Tried to upgrade to just-released Nginx1.4. TCP 3-way hand-shake  
> aborted by server’s ACK+RST packet, but netstat shows server  
> is listening on that port. Any config has been changed since Nginx 1.2  
> to 1.4 in this regard?

There are lots of changes in 1.4.0 compared to 1.2.x, see  
[http://nginx.org/en/CHANGES-1.4](http://nginx.org/en/CHANGES-1.4).

In this particular case I would recommend checking if nginx is  
listening on the port, the address, and the protocol in question.  
Note that since 1.3.4 ipv6only listen option is on by default, and  
if you have

```
listen [::]:80;

```

in your config, it no longer implies IPv4 addresses regardless of  
your OS settings.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 8:01pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/3 "2013-05-01T20:01:11Z")

</div>

netstat -pln shows the server is waiting on that port.

Yes, I have been using in server section  
listen [::]:80;  
What is supposed to be for IPV4 now?

I’ll go over the changelist later, Thanks,

- Alder

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 8:17pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/4 "2013-05-01T20:17:32Z")

</div>

Just for clarity, I want to be listening on both IPv4 and IPv6 on the  
same  
port.

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 11:08pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/5 "2013-05-01T23:08:40Z")

</div>

Hello!

On Wed, May 01, 2013 at 11:17:10AM -0700, Alder N. wrote:

> Just for clarity, I want to be listening on both IPv4 and IPv6 on the same  
> port.

You have to write

```
listen 80;
listen [::]:80;

```

to listen on both IPv4 and IPv6.

> > I’ll go over the changelist later, Thanks,
> > 
> > > > Tried to upgrade to just-released Nginx1.4. TCP 3-way hand-shake  
> > > > if you have
> > > 
> > > * * *
> > > 
> > > nginx mailing list  
> > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 11:25pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/6 "2013-05-01T23:25:37Z")

</div>

I tried  
listen [::]:80 ipv6only=off;  
and the TCP connection went through, but got  
an http 400 bad response.

It would be nice to have a corresponding config  
upgrade manual as well. Thanks,

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 11:19pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/7 "2013-05-01T23:19:47Z")

</div>

On Wed, May 1, 2013 at 2:07 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> listen [::]:80;
> 
> ```
> 
> to listen on both IPv4 and IPv6.

Doesn’t that require ipv6only=on?

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

```

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 1, 2013, 11:27pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/8 "2013-05-01T23:27:58Z")

</div>

Hello!

On Wed, May 01, 2013 at 02:18:44PM -0700, Paul N. Pace wrote:

> > ```
> > listen 80;
> > listen [::]:80;
> > 
> > ```
> > 
> > to listen on both IPv4 and IPv6.
> 
> Doesn’t that require ipv6only=on?
> 
> ```
> listen 80;
> listen [::]:80 ipv6only=on;
> 
> ```

As of nginx 1.3.4+, it’s on by default:

[…]

> > > > > Note that since 1.3.4 ipv6only listen option is on by default, and  
> > > > > if you have

[…]

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 3, 2013, 10:01am UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/9 "2013-05-03T10:01:21Z")

</div>

> Although [::]:80 ipv6only=off; does work as advertized (including for  
> localhost sockets), [::1]:80 ipv6only=off; fails to respond to v4  
> connections.

Which is expected, since ::1 is an ipv6 address.

Lukas

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 6, 2013, 6:20pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/10 "2013-05-06T18:20:27Z")

</div>

> > > > > “LT” == Lukas T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> > Although [::]:80 ipv6only=off; does work as advertized (including for  
> > localhost sockets), [::1]:80 ipv6only=off; fails to respond to v4  
> > connections.

LT\> Which is expected, since ::1 is an ipv6 address.

No it is not expected.

Everything else sees conenctions to anything in 127.0.0.0/8 when  
listen(2)ing to ::1 with bindv6only off.

## -JimC

James C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) OpenPGP: 1024D/ED7DAEA6

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 6, 2013, 6:33pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/11 "2013-05-06T18:33:19Z")

</div>

If this is a linux box you could simple use [::]:80 and it should, by  
default, responde to both v4 and v6…

"In Linux by default any IPv6 TCP socket also accepts IPv4 traffic using  
the IPv4 to IPv6 mapped address format, i.e., ::ffff:. E.g., ::ffff:192.168.0.27 maps the IPv4  
address  
192.168.0.27 to an IPv6 address.

When you enable the address [::]:80, binding port 80 using IPv6, in the  
listen directive, in Linux, by default, the IPv4 port 80 is also  
enabled.  
Meaning that nginx listens for both IPv4 and IPv6 incoming traffic.  
Therefore if you erroneously specify also a IPv4 address you’ll get an  
already bind address error when reloading nginx configuration." (  
[http://wiki.nginx.org/HttpCoreModule](http://wiki.nginx.org/HttpCoreModule)) "

So I guess ipv6only=off should do the same… and it should work… I  
can  
be 100% sure since I don’t have any box with nginx 1.4 + ipv6 yet!

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 3, 2013, 8:08am UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/12 "2013-05-03T08:08:00Z")

</div>

> > > > > “AN” == Alder N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

AN\> I tried  
AN\> listen [::]:80 ipv6only=off;

Although [::]:80 ipv6only=off; does work as advertized (including for  
localhost sockets), [::1]:80 ipv6only=off; fails to respond to v4  
connections.

## -JimC

James C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) OpenPGP: 1024D/ED7DAEA6

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 6, 2013, 7:14pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/13 "2013-05-06T19:14:48Z")

</div>

Hi Jim,

> Everything else sees conenctions to anything in 127.0.0.0/8

Not sure what you mean by everything else, but I don’t think  
thats the case.

See this example:

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 6, 2013, 8:00pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/14 "2013-05-06T20:00:24Z")

</div>

> > > > > “LT” == Lukas T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

LT\> Hi Jim,

> > Everything else sees conenctions to anything in 127.0.0.0/8

LT\> Not sure what you mean by everything else, but I don’t think  
LT\> thats the case.

Some time ago a message on debian-devel noted that deb was going to  
start  
defaulting to bindv6only=1. What is your /proc/sys/net/ipv6/bindv6only?

While looking into this, I found that, when given ::1, nc(1) explicitly  
listens to both ::1 and ::ffff:127.0.0.1. (Although it has a bug which  
causes it to close all v4 connections right after accept(2)ing them. 🙂

My expectation was that it would work, but it seems some applications  
force it to work by Doing What I Mean behind my back. 🙂

Evidently I’m going to have to write a test app to confirm things.

Probably later today.

## -JimC

James C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) OpenPGP: 1024D/ED7DAEA6

---

<div class="post-metadata">

**Author:** ![Alder\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71c47a/32.png) [@Alder\_N](https://www.ruby-forum.com/u/Alder_N)\
**Post date:** [May 6, 2013, 8:33pm UTC](https://www.ruby-forum.com/t/nginx-1-4-problem/228650/15 "2013-05-06T20:33:08Z")

</div>

Even when explicitly setting the socket option IPV6\_V6ONLY to 0  
(man 7 ipv6) - and thus ignoring cat /proc/sys/net/ipv6/bindv6only  
this doesn’t work.

> While looking into this, I found that, when given ::1, nc(1)  
> explicitly listens to both ::1 and ::ffff:127.0.0.1.

The behavior here is exactly the opposite. Perhaps you saw this  
with an older/buggy kernel or netcat release?

# terminal 1

> lukas@ubuntuvm:~$ nc -vv -l ::1 8080  
> Connection from 0.0.0.0 port 8080 [tcp/http-alt] accepted
> 
> asd  
> lukas@ubuntuvm:~$

# terminal 2

> asd  
> ^]  
> telnet\> quit  
> Connection closed.  
> lukas@ubuntuvm:~$

Regards,  
Lukas
