Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane

From: Maxim Dounin <mdounin-ux0u7sevaKovJsYlp49lxw <at> public.gmane.org>
Subject: Re: how to disable nginx internal dns cache?
Newsgroups: gmane.comp.web.nginx.english
Date: Monday 6th May 2013 13:59:10 UTC (over 5 years ago)
Hello!

On Mon, May 06, 2013 at 09:31:14AM -0400, nevernet wrote:

> i have resolver define, see below configuration:
> 
> server {
>  listen   80;
>  server_name  xx.com;
>  access_log  /var/log/nginx/xx-nginx.access.log;
>  error_log  /var/log/nginx/xx-nginx_error.log debug;
> 
> # resolver 8.8.8.8;
> # resolver_timeout 1s;
> 
>  #set your default location
>  location / {
> #  resolver 8.8.8.8 valid=5s;  # i have defined resolver at here ,and
also
> tried to add it in "http" section in nginx.conf file.   but both of them
> doesnt work. 
>   proxy_pass         http://p2.domain.com;
>  }

Resolver directive is only used if you use variables in 
proxy_pass.  Use something like this to force resolver usage:

    location / {
        set $backend "p2.domain.com";
        proxy_pass http://$backend;
    }

By default nginx resolvers hostnames to ip addresses while loading   
configuration, and will not re-resolve them unless you'll reload 
configuration (see http://nginx.org/en/docs/control.html).

-- 
Maxim Dounin
http://nginx.org/en/donation.html
 
CD: 21ms