HTTP core directives
resolver directive (http, server, location)
Context: http, server, location. Configures trusted runtime DNS; by default caches answers for their TTL. valid overrides cache validity. status_zone is commercial. The upstream-context form was commercial before OSS 1.27.3.
Formal Syntax & Structure
nginx syntaxnginx
resolver address ... [valid=time] [ipv4=on|off] [ipv6=on|off] [status_zone=zone];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| address | DNS server address with optional port (repeatable) | Use an approved resolver; default port 53. |
| valid | valid=duration | Override response TTL for cached answers. |
| ipv4 | ipv4=on|off | Select IPv4 queries; off supported since 1.23.1. |
| ipv6 | ipv6=on|off | Select IPv6 queries. |
| status_zone | status_zone=name | Commercial DNS metrics zone. |
Working Example
Example Snippetnginx
resolver 127.0.0.1:15353 valid=15s;