Listen on transient address

Ashish SHUKLA ashish.is at lostca.se
Fri Nov 16 08:00:38 UTC 2018


On 11/16/18 1:29 AM, Roger Fischer wrote:
> Hello,
> 
> I have an NGINX instance that listens on a tunnel (and some other
> interfaces). When NGINX was restarted while the tunnel was down (tun
> device and address did not exist), NGINX failed to start.
> 
>     [emerg] 1344#1344: bind() to 38.88.78.19:443 failed (99: Cannot
>     assign requested address)
> 
> 
> Relevant config:
> 
>     listen 172.16.200.5:80 default_server;
>     listen 38.88.78.19:80 default_server;   # tunnel, not always up
> 
> Is there a way to configure NGINX to listen “best effort”, still start
> even if it can’t bind to the address/port, and periodically retry to
> bind to the address/port? This would be my preferred solution.
> 
> Alternatively, if I pre-define the tunnel device and its address (I have
> not explored that yet), would NGINX bind successfully when the tunnel is
> down?

If using GNU/Linux, make sure /proc/sys/net/ipv4/ip_nonlocal_bind is set
to 1, and then you should be able to bind to any non-local IPv4 address.

HTH
-- 
Ashish SHUKLA | GPG: F682CDCC39DC0FEAE11620B6C746CFA9E74FA4B0

“Under certain circumstances, profanity provides a relief denied even to
prayer.” (Mark Twain)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20181116/d13e023b/attachment.bin>


More information about the nginx mailing list