Nginx reverse proxy crash when dns unavailable

Maxim Dounin mdounin at mdounin.ru
Thu Oct 22 22:22:58 MSD 2009


Hello!

On Thu, Oct 22, 2009 at 02:02:14PM -0400, masom wrote:

> Hi,
> 
> I am currently planning to use nginx on several thousand devices as a reverse-proxy caching system.
> 
> It currently work as expected (thanks Igor!), caches files as they are being requested by the devices.
> 
> 
> The only problem we hit is when nginx starts faster than the dns sytem is available on the units. Nginx will crash saying it is unable to connect to the remote host being proxied.
> 
> 
>  1739#0: host not found in upstream "content.dev.local" in /usr/local/nginx/conf/nginx.conf 33

Crashes and refuses to start is quite a different things.  As you 
have no DNS available during start - nginx just can't proceed any 
further since it doesn't know what your config means.  Once 
started it won't depend on DNS anymore.

To avoid such issues on start there are two basic options:

1. Use ip addresses in config instead of host names.

2. Make sure your OS resolving subsystem always returns meaningful 
results to nginx - either by launching nginx once DNS is available 
or by adding relevant entries to /etc/hosts.

Maxim Dounin

> 
> 
> Staring nginx again and it work (as the DNS is now responding properly).
> 
> 
> Any idea on how to work around this or should i fill a bug report (Nginx shouldn't crash when the remote is not available, but should try on requests to access it).
> 
> Nginx does not die when the remote drops and come back (by pulling the network cable for example). It only crash when nginx is launched and the dns sytem is not yet available.
> 
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,15995,15995#msg-15995
> 
> 





More information about the nginx mailing list