Caching Problem

Hello,

i got a clustered setup, where the content is beeing served from a nfs
share. thats why i want to cache the static components via nginx, but
unfortanly i didnt get it to work.

Heres my Config:

Global Configuration nginx.conf section http

 proxy_cache_path  /var/www/cache levels=1:2 keys_zone=ccdscache:32m

max_size=1000m inactive=7d;
proxy_temp_path /var/www/cache/tmp;

Vhost Config

server {
listen 80;
server_name xxx;

     location /server_status {

     stub_status on;
     access_log off;
     allow 127.0.0.1;
     allow xyz;
     deny all;
  }



     location ~*

.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$
{
root /srv2/xxx/htdocs;
proxy_cache ccdscache;
proxy_cache_valid 200 1m;
proxy_cache_key backend$request_uri;
proxy_cache_use_stale error timeout
invalid_header;

}

     location / {
         root   /srv2/xxx/htdocs;
         index  index.php index.html;
         if (!-e $request_filename) {
             rewrite  ^/(.*)$  /index.php?q=$1  last;
             break;
         }
     }

     error_page  404              /index.php;

error_page 500 502 503 504 /50x.html;

     location = /50x.html {
         root   html;
     }



     location ~ \.php$ {
         root   /srv2/xxx/htdocs;
          proxy_cache ccdscache;
          proxy_cache_valid  200 302  60m;
          proxy_cache_valid  404      1m;
           proxy_cache_key         backend$request_uri;
            proxy_cache_valid       200  1h;
            proxy_cache_use_stale   error timeout invalid_header;

         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php;
         fastcgi_param  SCRIPT_FILENAME

/srv2/xxx/htdocs$fastcgi_script_name;
include /etc/nginx/fastcgi_params;

     }
 }

any ideas whats wrong here?

Thanks!

Hi,

any ideas whats wrong here?

You’re using “proxy_cache_*” (which works only with “proxy_pass”) with
static files and FastCGI.

For FastCGI use “fastcgi_cache_*”, for static files use ngx_slowfs_cache
[1].

[1] FRiCKLE Labs / nginx / ngx_slowfs_cache

Best regards,
Piotr S. < [email protected] >

Thanks :slight_smile:

Am 21.12.10 12:59, schrieb Piotr S.: