我有一个简单的nginxconfiguration;
server{ servername localhost; root /var/www/webroot; location / { set_md5 $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; } }
我有一个CakePHP助手,使用MEM_KEY参数将视图保存到memcached中。 我已经testing过它,它的工作,但是,nginx总是去@fallback方向。 我该如何解决这个问题呢? 这个问题可以解决吗?
由于DukeLion的意见,我终于可以发现什么whas发生了,nginx正在做的memcached服务器okey,但cakephp是inflecting的关键。
例如,我尝试访问/home_page.html
Nginx做一个到/home_page.html的memcache,不要find它,所以它加载cakephp,cakephp生成视图,并保存在关键_home__page_html
解决scheme是扩展memcached cakephp引擎。
谢谢!!!
pd:你可以在http://andy-gale.com/cakephp-view-memcache.html中的memcached视图引擎的样本