@@ -20,6 +20,8 @@ Pair nginx-proxy with your favorite upstream server (wsgi, uwsgi, asgi, et al.)
2020| ` STATUS_LISTEN_PORT ` | nginx status port | No | 8091 | |
2121| ` UPSTREAM_SERVER ` | Upstream server | Yes | | myapp:8080 fail_timeout=0, unix://mnt/server.sock |
2222| ` PROXY_REVERSE_URL ` | Upstream server URL (Deprecated, please use UPSTREAM_SERVER) | No | | http://myapp:8080 |
23+ | ` NGINX_RESOLVER ` | Value for nginx ` resolver ` directive | No | auto* | ` 169.254.169.253 valid=60s ` |
24+ | ` UPSTREAM_RESOLVE ` | Enable dynamic DNS resolution for the upstream (` resolve ` parameter) | No | 0 | 1 |
2325| ` SERVER_NAME ` | Allowed server names (hostnames) | Yes | | |
2426| ` SILENT ` | Silence entrypoint output | No | | |
2527| ` STATIC_LOCATIONS ` | Static asset mappings | No | | |
@@ -30,6 +32,20 @@ Pair nginx-proxy with your favorite upstream server (wsgi, uwsgi, asgi, et al.)
3032| ` LOG_ONLY_5XX ` | only log 5XX HTTP status access events | No | 0 | 1 |
3133| ` WORKER_CONNECTIONS ` | Set the number of allowed worker connections | No | 1024 | 2048 |
3234
35+ * Defaults to 169.254.169.253 valid=60s when ` UPSTREAM_RESOLVE=1 ` and no custom resolver is provided.
36+
37+ ### Handling DNS Changes
38+
39+ If your upstream service rotates IP addresses (for example when fronted by a load
40+ balancer), configure nginx to re-resolve the upstream host name by setting
41+ ` NGINX_RESOLVER ` to the DNS servers you want nginx to use and enabling
42+ ` UPSTREAM_RESOLVE=1 ` . The value of ` NGINX_RESOLVER ` is passed directly to the
43+ [ ` resolver ` directive] [ nginx-resolver ] , so you can include modifiers such as
44+ ` valid=60s ` or ` ipv6=off ` . When using a unix socket (` UPSTREAM_SERVER=unix://… ` )
45+ the resolve option is ignored.
46+ If you leave ` NGINX_RESOLVER ` unset, nginx-proxy defaults to AWS's metadata
47+ resolver (` 169.254.169.253 valid=60s ` ) whenever ` UPSTREAM_RESOLVE=1 ` .
48+
3349### Hosting Static Assets
3450
3551Static files can be hosted from your proxied application by sharing a volume
@@ -93,3 +109,4 @@ Notable differences from the official [nginx container][]
93109[gomplate] : https://docs.gomplate.ca/
94110[uwsgi] : https://uwsgi-docs.readthedocs.io/en/latest/
95111[nginx status] : https://nginx.org/en/docs/http/ngx_http_stub_status_module.html
112+ [nginx-resolver] : https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
0 commit comments