nginx serving old files from cache

VRider nginx-forum at nginx.us
Wed Apr 18 10:09:51 UTC 2012


I have nginx set as reverse proxy for Apache and for serving static
files.
Everything works great, except in the last few weeks I noticed that
sometimes nginx returns page from cache which is 3-4 hours old. I
checked the timestamp of the cache file, and it is old.

This is part of the config file related to caching in nginx.conf:
    proxy_cache off;
    proxy_buffering on;
    proxy_buffer_size 8k;
    proxy_buffers 100 8k;
    proxy_cache_path  /var/www/cache levels=1:2 keys_zone=my-cache:8m
max_size=1000m;
    proxy_temp_path /var/www/cache/tmp;
    proxy_cache_key "$host$request_uri";
    proxy_ignore_headers "Expires" "Cache-Control" "X-Accel-Expires";

and this is for particulat vhost:
            proxy_cache my-cache;
            proxy_cache_valid  200 404     1m; # <----- should be valid
for just one minute!
            proxy_ignore_headers Expires;
            proxy_ignore_headers Cache-Control;
            proxy_ignore_headers X-Accel-Expires;
            proxy_ignore_headers Set-Cookie;
            proxy_hide_header Set-Cookie;

Any ideas?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,225467,225467#msg-225467



More information about the nginx mailing list