How to turn off DNS caching

Jim Ohlstein jim at
Wed May 4 11:48:05 UTC 2016


On May 4, 2016, at 7:12 AM, Sem9999 <nginx-forum at> wrote:

> Hi,
> I am trying to connect to my AWS RDS (mysql) instance using the AWS supplied
> DNS endpoint.
> The problem is, the IP of the instance changes periodically.
> It appears that nginx does not resolve the DNS name every time, but caches
> it. 
> Therefore nginx initially works, then at some point later, things break.
> How can I turn off the DNS caching?

Add a "valid" parameter to your resolver directive:

resolver valid=5s;

This would set it to cache 5s.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list