在我的网站上,我用memcached进行了数据缓存.它存储完全生成的html页面.下一步是通过nginx从memcached获取此数据并发送回用户w\o启动apache进程.首先,我试图通过php后端从缓存中获取数据并且它有效.但是,当我尝试使用nginx时 - 我看到几乎没有损坏的数据.喜欢
我正在寻求这个问题的帮助.
ps这里是nginx配置的一部分,如果它可以帮助
location / {
#add_header Content-Type "text/html";
set $cachable 1;
if ($request_method = POST){
set $cachable 0;
break;
}
if ($http_cookie ~ "beauty_logged") {
set $cachable 0;
break;
}
if ($cachable = 1) {
set $memcached_key 'nginx_$host$uri';
memcached_pass 127.0.0.1:11211;
}
default_type text/html;
error_page 404 502 504 405 = @php;
#proxy_pass http://front_cluster;
}
location @php {
proxy_pass http://front_cluster;
}
Run Code Online (Sandbox Code Playgroud)