nginx重新编译添加ngx_cache_purge扩展
2015-09-06 15:22
627 查看
参考资料:
nginx官网ngx_cache_purge扩展参考:http://wiki.nginx.org/CachePurgeChs
张宴的技术博文:http://zyan.cc/nginx_cache/
查看nginx编译参数:
安装ngx_cache_purge的目的是为了清除nginx反向代理服务器上的文件缓存,不过今天线上服务器因为没有ngx_cache_purge扩展
建议还是用官网的解决办法进行。
nginx官网ngx_cache_purge扩展参考:http://wiki.nginx.org/CachePurgeChs
张宴的技术博文:http://zyan.cc/nginx_cache/
查看nginx编译参数:
[root@test31 php]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.6.3 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1c --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.36下载ngx_cache_purge,然后解压
[root@test31 nginx-1.6.3]# wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz [root@test31 nginx-1.6.3]#tar -zxvf ngx_cache_purge-2.3.tar.gz返回nginx之前编译的目录,使用--add-module=/usr/local/src/ngx_cache_purge-2.3,将ngx_cache_purge添加编译
[root@test31 src]# cd nginx-1.6.3 [root@test31 nginx-1.6.3]# pwd /usr/local/src/nginx-1.6.3 [root@test31 nginx-1.6.3]#./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1c --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.36 --add-module=/usr/local/src/ngx_cache_purge-2.3 [root@test31 nginx-1.6.3]#make [root@test31 nginx-1.6.3]#make install无报错,重新编译结束,查看nginx编译参数
[root@test31 nginx-1.6.3]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.6.3 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1c --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.36 --add-module=/usr/local/src/ngx_cache_purge-2.3二.清除nginx反向代理缓存
安装ngx_cache_purge的目的是为了清除nginx反向代理服务器上的文件缓存,不过今天线上服务器因为没有ngx_cache_purge扩展
[wo@yy235 ~]$ cd /usr/local/nginx/conf/vhost.d/ [wo@yy235 vhost.d]$ more www.yu23.com.conf proxy_cache_path /var/cache/web/www.yu23.com levels=1:1:2 keys_zone=search:4096m inactive=30m max_size=16g;找到缓存文件目录
/var/cache/web/www.yu23.com直接删除目录下所有文件,成功清楚缓存。这个办法很黄很暴力,不适合大流量网站使用。
建议还是用官网的解决办法进行。
相关文章推荐
- nginx
- nginx在linux平台下搭建
- 基于LNMP搭建Discuz!论坛
- Linux运维文档之nginx
- nginx索引目录配置
- nginx实现图片防盗链(referer指令)
- nginx限速白名单配置
- nginx正向代理
- nginx 编译参数详解(运维不得不看)
- Nginx 战斗准备 —— 优化指南
- 确保nginx安全的10个技巧
- nginx教程全集汇总
- 在linux下编译安装nginx
- Nginx安全配置
- nginx禁止访问目录中可执行文件
- nginx日志切割
- 构建基于Nginx的文件服务器思路与实现 - 宋黎晓的博客 - OECP社区
- 使用nginx+lua实现自己的logserver | 星期八的博客 web & game
- 让nginx支持文件上传的几种模式 - jlins - 博客园
- 使用Nginx+Lua进行断点上传的demo - xcc的博客 - 博客频道 - CSDN.NET