我有一个简单的nginx配置;
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中.我已经测试了它并且它正在工作,但是,nginx总是会进入@fallback方向.我该如何解决此问题?可能会出现问题吗?
最佳答案
感谢DukeLion的评论,我终于可以找到发生了什么,nginx正在进入memcached服务器okey,但是cakephp正在改变密钥.
例如,我尝试访问/home_page.html
Nginx使用/home_page.html进入内存缓存,不要找到它,因此加载cakephp,cakephp生成视图并将其保存在密钥_home__page_html中
解决方案是扩展memcached cakephp引擎.
谢谢!!!
pd:您可以在http://andy-gale.com/cakephp-view-memcache.html中获取memcached视图引擎的示例
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。