nginx cache as reverse proxy.

Igor Sysoev igor at
Sat Feb 27 00:42:22 MSK 2010

On Fri, Feb 26, 2010 at 11:32:16AM -0600, David Taveras wrote:

> Hello,
> I would like to know if I dont set any time in proxy_cache_valid ,
> will nginx base the amount of time it should cache a file from the
> proxied server response header "Expires Cache-Control" ?

Yes, nginx chooses cache time in the following order:
1) X-Accel-Expires header
2) Expires/Cache-Control headers
3) proxy_cache_valid directive

> Also, once I have this set does turning on the cache mean that if
> gifs/jpgs/txt/html files have a long expiry period of time in them
> from the proxied server .. does that mean that nginx will make ZERO
> requests to that server.. or would it still have ti fetch the HEADER
> of those files every time just to check if it has changed?

Zero requests.

> Objective:
> Trying to configure the cache on nginx to read the png/gif/html/txt
> header once and NOT many ANY rquest to the backend server for that
> file (not even a head request) for the time being the Cache Expire
> control for that particular file is valid.

Igor Sysoev

More information about the nginx mailing list