FastCGI cache (WordPress)

I’m trying to set up fastcgi_cache with nginx+php-fpm. I can see
directories appearing in my cache dir, but pages that I expect to return
a cached hit, are downloaded (0 kb files) rather than served as a web
page. I can see why it might be the default_type setting, but I don’t
know what else to set it to, or how to override the setting inside the
location block.

user www-data;
worker_processes 4;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
  worker_connections  1024;
}

http {
  server_names_hash_max_size 512;
  server_names_hash_bucket_size 128;

  index index.php index.html index.htm;

  include       mime.types;
  default_type  application/octet-stream;

  fastcgi_cache_path  /var/cache/nginx  levels=1:2
keys_zone=WORDPRESS:10m inactive=5m;

  access_log /var/log/nginx/access.log;
  sendfile   on;

  keepalive_timeout  65;

  gzip  on;
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}


server {
  listen      127.0.0.1:80 default;
  server_name www.mysite.com;

  error_log  /var/log/nginx/www.mysite.com-error.log;
  access_log /var/log/nginx/www.mysite.com-access.log;

  root  /home/graq/sites/www.mysite.com;


  location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;
  }

  location ~ \.php$ {
    set $wordpress_logged_in  "";
    set $comment_author_email "";
    set $comment_author       "";

    if ($http_cookie ~* "wordpress_logged_in_[^=]*=([^%]+)%7C") {
      set $wordpress_logged_in wordpress_logged_in_$1;
    }

    if ($http_cookie ~* "comment_author_email_[^=]*=([^;]+)(;|$)") {
      set $comment_author_email comment_author_email_$1;
    }

    if ($http_cookie ~* "comment_author_[^=]*=([^;]+)(;|$)") {
      set $comment_author comment_author_$1;
    }

    set $my_cache_key
"$scheme://$host$uri$is_args$args$wordpress_logged_in$comment_author_email$comment_author";

    fastcgi_pass_header     Set-Cookie;
    fastcgi_cache_use_stale error timeout invalid_header http_500;
    fastcgi_cache_key       $my_cache_key;
    fastcgi_cache           WORDPRESS;
    fastcgi_cache_valid     200 1m;

    fastcgi_pass  unix:/usr/local/var/run/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO       $fastcgi_script_name;
    include fastcgi_params;
  }
}

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