nginx failing to resolve upstream names on reload even if they DO resolve by the OS

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.