Problem with fastcgi cache

Hello, I´m working with Nginx v1.0.8.

I have the configuration for fastcgi cache:

server {
listen 8080;

    //many other lines of configuration

   fastcgi_cache_path /var/www/cache levels=1:2 keys_zone=zera:10m

inactive=5m;
fastcgi_temp_path /var/www/cache/tmp;

  server {

listen 80;
server_name localhost;

    //more configuration

    location ~ "^(.+\.php)(/.+)" {
    set $script $uri;
    set $path_info "";

    error_log  logs/debug.log  debug;

    set $script $1;
    set $path_info $2;

    #fastcgi_pass   127.0.0.1:9000;
    fastcgi_pass   unix:/var/run/php.sock;
    fastcgi_cache zera;
    fastcgi_cache_key $server_addr$request_uri;

fastcgi_cache_valid 200 302 1h;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid any 1m;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_index index.php;

    include        fastcgi_params;

    fastcgi_param  SCRIPT_FILENAME  /var/www/myapp/web$script;
    fastcgi_param  SCRIPT_NAME      $script;
    fastcgi_param  PATH_INFO        $path_info;
}

I can´t see the nginx creating files in /var/www/cache or
/var/www/cache/tmp.

The php process is actually doing the work.

Looking at the debug logs I can see:

2011/10/29 19:36:18 [debug] 32377#0: *1 post access phase: 10
2011/10/29 19:36:18 [debug] 32377#0: *1 http init upstream, client
timer: 0
2011/10/29 19:36:18 [debug] 32377#0: *1 epoll add event: fd:15 op:3
ev:80000005
2011/10/29 19:36:18 [debug] 32377#0: *1 http script var:
“10.128.50.101”
2011/10/29 19:36:18 [debug] 32377#0: *1 http script var:
“/administration.php/school”
2011/10/29 19:36:18 [debug] 32377#0: *1 http cache key:
“10.128.50.101/administration.php/school”
2011/10/29 19:36:18 [debug] 32377#0: *1 add cleanup: 092C6E3C
2011/10/29 19:36:18 [debug] 32377#0: *1 http file cache exists: -5 e:0
2011/10/29 19:36:18 [debug] 32377#0: *1 cache file:
“/var/www/cache/8/4f/2de84a2a49161ae7d7d4d8fba314e4f8”
2011/10/29 19:36:18 [debug] 32377#0: *1 add cleanup: 092C6E80
2011/10/29 19:36:18 [debug] 32377#0: *1 http upstream cache: -5
2011/10/29 19:36:18 [debug] 32377#0: *1 http script copy:
“QUERY_STRING”

I preciate any help with this issue.

Thanks in advance.

Posted at Nginx Forum:

For more information my nginx server is installed in Ubuntu 10.04,
compiled from sources the following compilation options:

./configure --user=www-data --group=www-data --with-http_ssl_module
–with-http_realip_module --with-http_addition_module
–with-http_sub_module --with-http_dav_module --with-http_flv_module
–with-http_gzip_static_module --with-http_random_index_module
–with-http_secure_link_module --with-http_stub_status_module
–with-debug

Posted at Nginx Forum:

Problem solved. The solution was include the statements:

fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

I added the configuration to log the cache request result (HIT or
MISS):

log_format cache '$remote_addr - $remote_user [$time_local] “$request”

'$status $upstream_cache_status $body_bytes_sent
“$http_referer” ’
‘“$http_user_agent” “$http_x_forwarded_for”’;

access_log  logs/access.log  cache;

And now you can see in the log:

10.35.9.129 - - [02/Nov/2011:12:41:00 -0400] “GET
/administration.php/school HTTP/1.1” 200 HIT 2712
http://10.128.50.101/administration.php/school” “Mozilla/5.0 (Windows
NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0” “-”

Posted at Nginx Forum: