proxy_cache not working for me

amodpandey nginx-forum at nginx.us
Thu Jun 21 22:45:32 UTC 2012


http {

  proxy_cache_path        /dev/shm/cache/nginx/ levels=1:2
keys_zone=cache:30m inactive=1d  max_size=500M;
  proxy_temp_path         /dev/shm/cache/nginx/tmp 1 2;
  proxy_cache_key         "$scheme$request_method$request_uri";

server {
 ..

   location /  {
      add_header X-Cache-Status $upstream_cache_status;
      proxy_pass            $scheme://default;
      proxy_cache           cache;
      proxy_cache_valid     200      30m;
      proxy_cache_min_uses  1;
      proxy_ignore_headers  "Expires" "Cache-Control";
      proxy_cache_use_stale error  timeout invalid_header http_500;
    }

----

I am always getting a MISS. nginx 1.2.1

Response Header

Cache-Control:no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Connection:keep-alive
Content-Encoding:gzip
Content-Type:application/json
Date:Thu, 21 Jun 2012 22:37:26 GMT
Expires:Mon, 26 Jul 1997 05:00:00 GMT
Pragma:no-cache
Server:nginx
Transfer-Encoding:chunked
Vary:Accept-Encoding, Accept-Encoding
X-Cache-Status:MISS
X-Powered-By:PHP/5.3.6

Similar setting has worked for me on another set up! Could someone helpe
me with some pointers.

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



More information about the nginx mailing list