Friday, January 14, 2011

cpNginx Memory cache control

It is easy to control cache options of your static and dynamic files easily in this nginx plugin. See the details below,
-------------


You can enable caching of static and dynamic files in Nginx plugins easily . It need to do the following two steps .

Step 1: You need to edit Nginx main configuration file from the plugin page and add the following lines.

proxy_cache_path /usr/local/nginx/proxy_cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
proxy_temp_path /usr/local/nginx/proxy_temp ;


Step 2: Edit the vhost configuration from the plugin page and add the following lines.

proxy_cache my-cache;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;

Now rebuild nginx vhost and restart . Please note , you need good amount of free space to hold the cache files.

No comments:

Post a Comment