Nginx, memcached and cakephp: memcached module always misses cache
- by Tim
I've got a simple nginx configuration;
server{
servername localhost;
root /var/www/webroot;
location / {
set $memcached_key $uri;
index index.php index.html;
try_files $uri $uri/ @cache;
}
location @cache {
memcached_pass localhost:11211;
default_type text/html;
error_page 404 @fallback;
}
location @fallback{
try_files $uri $uri/ /index.php?url=$uri&$args;
}
location ~ \.php$ {
fastcgi_param MEM_KEY $memcached_key;
include /etc/nginx/fastcgi.conf;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
I've got a CakePHP helper that saves the view into memcached using the MEM_KEY parameter. I have tested it and it's working, however, nginx is always going to the @fallback direction. How can I go about troubleshooting this behavior? Would could the problem be?