Domain names used in nginx configuration are normally resolved during parsing of the configuration. Currently, the only exceptions are:
- When
proxy_pass
, fastcgi_pass
, etc. directives contain variables.
- When using
ssl_stapling
and resolving OCSP responder hostname.
- When using a
server ... resolve;
in an upstream
block (available as a part of the commercial subscription).
All these cases explicitly document that they are using resolver
. For example, quoting proxy_pass documentation:
Parameter value can contain variables. In this case, if an address is specified as a domain name, the name is searched among the described server groups, and, if not found, is determined using a resolver.
Don't expect that names written in the configuration will be re-resolved by nginx periodically. Depending on the particular use case, you may want to either reconfigure nginx as IP addresses change, or configure nginx in a way which implies period re-resolution of names you want to be re-resolved.
Note that re-resolution implies run-time overhead and also may end up with a non-working nginx if DNS server won't be reachable. On the other hand, nginx reconfiguration implies additional resource usage till reconfiguration complete, which may take a while. For this and other reasons automatic reconfiguration might not be a good idea.