Welcome! Log In Create A New Profile

Advanced

Re: bind failed

Maxim Dounin
December 01, 2015 08:02AM
Hello!

On Tue, Dec 01, 2015 at 12:49:50AM -0800, Frank Liu wrote:

> Hi,
>
> I was doing some tests today and have created a single test virtual host
> with
> listen 8181;
> and nginx runs fine (1.9.7). Now if I change the listen to only one
> interface ip:
> listen 192.168.10.10:8181
> configtest shows fine but reload gives "bind failed" in the error log.
> Is this normal?

Short answer:

Yes, if you are using Linux.

Long answer:

Linux doesn't allow listen sockets on INADDR_ANY and an IP address
on the same port to coexist, due to "security" reasons. And this
is exactly what happens when you try to reload a configuration -
nginx still has an open listening sockets on *:8181 and tries to
open another one on 192.168.10.10:8181. As a result, the bind()
system call fails due to the Linux limitation, and that's what you
see in the error log. To switch from a listening on * to an IP
address on Linux you'll have to restart nginx, reload won't work.

The same process works fine on other OSes without such artificial
limitations (e.g., FreeBSD).

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

bind failed

Frank Liu December 01, 2015 03:50AM

Re: bind failed

Maxim Dounin December 01, 2015 08:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready