questions on proper use of proxy_cache for Wordpress

nerdgrind nginx-forum at nginx.us
Wed Dec 9 00:05:51 MSK 2009


I have a Wordpress blog I'd like to cache files for in the built-in Nginx cache. I'm not completely sure what is cached, or even how to find out. I have WP Super Cache that generates .html files, and I would like to cache those files in Nginx for only 15 minutes. I would like to have all of the other static files such as .css, .png, .gif, .js, etc., stored for 1 year, but I would like those files to be replaced if the file changes. I'm not sure what else the Nginx cache stores, or what I should do to limit the time on those stored items to make sure my blog homepage refreshes every 15 minutes, since my understanding of this type of cache is limited.

How can I configure the cache to minimize the impact on the CPU load, but still get a refreshed homepage, and post pages, every 15 minutes?

Are the subdirectories that store the cached items deleted along with the items? Are those subdirectories left empty, or are they reused for new stored items after expired items are deleted?

I also could not find any information about "proxy_cache_key" in the wiki. I only found information about "proxy_cache_key" in a response from Igor on how to configure the cache.

In http:


proxy_cache_path        /tmp/my_cache levels=1:2
                        keys_zone=my_cache:15m
                        inactive=15m max_size=200m;


In server:


location / {
            proxy_pass         http://127.0.0.1:8008;
            proxy_cache             my_cache;
            proxy_cache_key  $scheme$proxy_host$uri$is_args$args;
            proxy_cache_use_stale   error timeout invalid_header updating http_500 http_502 http_503 http_504 http_404;
            proxy_cache_methods POST;
            proxy_cache_valid 15m;
            break;
        }


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




More information about the nginx mailing list