When reloading config (specifically for proxy_pass) - occasionally this will be seen: nginx: [emerg] host not found in upstream

However - the upstream server's name WILL resolve in the os (linux) - only nginx seems to have this problem.

This seems to be a recent regression - as it didn't seem to happen previous to 1.0.10 versions.

Has anyone noticed this recently?

Trying to narrow down places to search.

1 Answer 1


Nginx internally caches DNS for 5 minutes (not sure if this is configurable in later versions). Perhaps your resolver is failing for some reason, then Nginx caches this result.

I have seen this on systems with IPv6 enabled since be default the resolver requests both IPv4 and IPv6 records in parallel. This can be seen as a flood by the resolver resulting in a temporary DNS issue. I saw this popup on a box with a lot of email traffic when doing domain name verification.

Try adding:

  options single-request

to /etc/resolv.conf

This causes IPv6/v4 lookups to be done sequentially.

  • Thanks for your answer. It turned out this was an error with messing up the hostnames in the config files. Oops. But your answer is actually really useful anyway - so I will mark it as the right one - as it would cause DNS issues, for sure (blasting it with requests). Jan 31, 2012 at 3:35
  • 2
    I have the same issue - what exactly did you do in the config files to fix this (thanks in advance)
    – Zabs
    Oct 27, 2014 at 10:58
  • You can now add the value=30s option to the resolver to define how long a resolved IP address should be kept in the resolver's caches. Mar 15, 2019 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.