DNS resolution of backends

Reinis Rozitis r at roze.lv
Thu Jun 5 15:20:35 UTC 2014


> We run a reverse proxy to Amazon S3 service. Sometime Amazon change their
> IPs and some of them may become unresponsive and render reservse proxy
> unusuable. Is there options to force nginx to re-resolve IPs of backends
> lets say each 5 mins ?

Give the upstream{} block the hostnames of the instances and add an resolver 
( http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver ).

Optionally add valid=5m; if the TTL of the domain is not optimal.


p.s. for the nginx to be more responsive you can also tweak the connect 
timeouts like proxy_connect_timeout ( 
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout 
 ) as the default is quite high - 60 seconds.

rr




More information about the nginx mailing list