proxy_cache ramdisk

AMP Admin admin at ampprod.com
Mon Feb 1 01:26:05 MSK 2010


I'm able to cache php pages with the following but I can't seem to cache
static images with proxy_cache.

 

 

This works:

                                location ~ \.php$ {

                                                fastcgi_index
index.php;

                                                fastcgi_pass
127.0.0.1:9000;

                                                fastcgi_cache
cachephp;

                                                fastcgi_cache_key
127.0.0.1:9000$request_uri;

                                                fastcgi_cache_valid
200  1h;

                                                include
fastcgi_params;

                                                fastcgi_intercept_errors
On;

                                                fastcgi_ignore_client_abort
On;

                                                fastcgi_buffer_size
128k;

                                                fastcgi_buffers
4 128k;

                                }

 

This does not work:

                                location ~*
\.(jpg|jpeg|gif|css|png|js|ico|tif)$ {

                                                access_log
off;

                                                expires
30d;

                                                proxy_pass
http://127.0.0.1;

                                                proxy_cache_key
$scheme$host$request_uri

                                                proxy_cache
cachestatic;

                                                proxy_cache_valid
200  1h;

                                                proxy_cache_valid
404  5m;

                                                break;

                                }

 

Using:

                fastcgi_temp_path
/etc/nginx/temp_cache;

                fastcgi_cache_path                         /etc/nginx/cache

 
levels=1:2

 
keys_zone=cachephp:10m

 
inactive=7d

 
max_size=128m;

 

                proxy_temp_path
/etc/nginx/temp_cache;

                proxy_cache_path                          /etc/nginx/cache

 
levels=1:2

 
keys_zone=cachestatic:10m

 
inactive=7d

 
max_size=128m;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100131/df181ffd/attachment.html>


More information about the nginx mailing list