nginx fastcgi_cache
2016-07-20 17:56
302 查看
参考
http://www.cnxct.com/several-reminder-in-nginx-fastcgi_cache-and-php-session_cache_limiter
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache
fastcgi_cache的清除需要使用ngx_cache_purge这个模块.
ngx_cache_purge 是 nginx 的第三方那个模块,用于清除
FastCGI, proxy, SCGI and uWSGI 缓存
参考:
点击打开链接https://www.cnhzz.com/nginx_cache_purge/
点击打开链接http://54im.com/nginx/ngx_cache_purge.html
或者
自己写方法删除缓存目录下的文件
举例:
fastcgi_cache_path /www/php_cache levels=1:2 keys_zone=cache_php:30m inactive=1d max_size=10g;
1:2会生成16*256个字目录
参考:点击打开链接http://www.lvtao.net/server/224.html#comment-1904
http://www.cnxct.com/several-reminder-in-nginx-fastcgi_cache-and-php-session_cache_limiter
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache
fastcgi_cache_path /data/files/game/nginxCache/content levels=1:2 keys_zone=Hpp:250m inactive=1d max_size=1G; fastcgi_temp_path /data/files/game/nginxCache/temp; fastcgi_cache_key "$scheme$request_method$host$request_uri$is_args$args"; fastcgi_cache_use_stale error timeout invalid_header http_500; #nocache fastcgi_ignore_headers "Cache-Control" "Expires" "Set-Cookie";
server{ set $skip_cache 0; #post访问不缓存 if ($request_method = POST) { set $skip_cache 1; } #动态查询不缓存 if ($query_string ~* "nonocache") { set $skip_cache 1; } #后台等特定页面不缓存(其他需求请自行添加即可) if ($request_uri ~* "users") { set $skip_cache 1; } if ($request_uri ~* "reply.php") { set $skip_cache 1; } #对登录后的结果缓存(hehe就是一个判断登录与否的Cookei名称) if ($http_cookie ~* "ECM_ID") { set $skip_cache 1; } fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; add_header X-Cache "$upstream_cache_status From $host"; add_header KCache "$scheme$request_method$host$request_uri$is_args$args"; fastcgi_cache Hpp; fastcgi_cache_valid 200 301 302 1d; }
fastcgi_cache的清除需要使用ngx_cache_purge这个模块.
ngx_cache_purge 是 nginx 的第三方那个模块,用于清除
FastCGI, proxy, SCGI and uWSGI 缓存
参考:
点击打开链接https://www.cnhzz.com/nginx_cache_purge/
点击打开链接http://54im.com/nginx/ngx_cache_purge.html
或者
自己写方法删除缓存目录下的文件
举例:
fastcgi_cache_path /www/php_cache levels=1:2 keys_zone=cache_php:30m inactive=1d max_size=10g;
1:2会生成16*256个字目录
root@vbstevena nginxCache # find . -type f ./content/8/2d/4573270729c3db4e26e68198e5a1c2d8 ./content/4/81/75a8c077cb22d087cf61c233a2184814 ./content/1/6e/a4a589e68d5352e716f4033d01c026e1
<?php function purgeCache() { $url = $this->post('url'); if (empty($url) || !Cola_Com_Validate::url($url)) { exit('请输入正确的URL。'); } $md5 = md5($url); $cacheFile = $this->_cacheRoot . '/' . substr($md5, -1) . '/' . substr($md5, -3, 2) . '/' . $md5; if (!file_exists($cacheFile)) { exit('缓存不存在。'); } if (@unlink($cacheFile)) { echo '清除缓存成功。'; } else { echo '清除缓存失败。'; } }
参考:点击打开链接http://www.lvtao.net/server/224.html#comment-1904
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误
- 基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS