nginx清除缓存ngx_cache_purge
来源:互联网 发布:剑网三捏脸数据图 编辑:程序博客网 时间:2024/06/14 06:06
nginx ip:172.18.3.184 web服务 ip:172.18.11.247
ngx_cache_purge模块github下载地址及使用说明
二:nginx.conf
三:测试
ngx_cache_purge模块github下载地址及使用说明
https://github.com/FRiCKLE/ngx_cache_purge/
一:nginx安装
yum install -y patch unzip gcc openssl openssl-devel pcre pcre-develtar fxz nginx-1.7.8.tar.gztar fxz ngx_cache_purge-2.2.tar.gzcd nginx-1.7.8./configure --prefix=/usr/local/nginx --add-module=../ngx_cache_purge-2.2/ --with-http_stub_status_module --with-http_ssl_modulemake && make install
二:nginx.conf
http { include mime.types; default_type application/octet-stream; proxy_cache_path /tmp/cache keys_zone=tmpcache:10m; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { proxy_pass http://172.18.11.247; proxy_read_timeout 2000s; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_cache tmpcache; proxy_cache_key $uri$is_args$args; } location ~ /purge(/.*) { allow all; deny all; proxy_cache_purge tmpcache $1$is_args$args; } location ~ \.(gif|jpg|jpeg|png|bmp|ico)$ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://172.18.11.247; proxy_cache tmpcache; proxy_cache_key $uri$is_args$args; add_header OpenCDN-Cache "$upstream_cache_status"; #测试时可以查看cache状态 proxy_cache_valid 200 304 12h; expires 1d; }}
三:测试
/usr/local/nginx/sbin/nginx -s reload[root@purge cache]# curl --head 172.18.3.184/resources/style/common/css/images/ItemsIco02.pngHTTP/1.1 200 OKServer: nginx/1.8.1Date: Wed, 30 Nov 2016 15:16:20 GMTContent-Type: image/pngContent-Length: 3775Connection: keep-aliveETag: W/"3775-1411717259000"Last-Modified: Fri, 26 Sep 2014 07:40:59 GMTExpires: Thu, 01 Dec 2016 15:16:20 GMTCache-Control: max-age=86400OpenCDN-Cache: HITAccept-Ranges: bytes[root@purge cache]# curl --head 172.18.3.184/purge/resources/style/common/css/images/ItemsIco02.pngHTTP/1.1 200 OKServer: nginx/1.8.1Date: Wed, 30 Nov 2016 15:16:40 GMTContent-Type: text/htmlContent-Length: 292Connection: keep-alive四:注意 404的时候注意配置文件
proxy_cache_key
proxy_cache_purge两个的一致性
0 0
- nginx清除缓存ngx_cache_purge
- linux + nginx + ngx_cache_purge 缓存清理
- nginx安装第三方ngx_cache_purge模块,purge命令清除静态缓存
- nginx反向代理,动静态请求分离,以及nginx缓存应用,以及使用ngx_cache_purge清除指定URL
- nginx缓存配置和ngx_cache_purge总结
- Nginx缓存配置及nginx ngx_cache_purge模块的使用
- Nginx:Purge,ngx_cache_purge模块
- nginx+Ngx_cache_purge配置笔记
- nginx清除缓存图片
- Nginx系列教程:ngx_cache_purge模块
- Nginx Purge清除缓存配置
- Nginx系列(十五. nginx清除缓存)
- 使用Shell脚本批量清除Nginx缓存
- nginx根据日志清除缓存脚本
- 清除nginx服务器网站缓存数据
- nginx内置缓存Proxy_cache之清除
- nginx+lua_nginx+GraphicsMagick缩略图+tfs获取原图+ngx_cache_purge
- Nginx 编译,添加未编译安装模块ngx_cache_purge
- Qt5:QML:c++ 调用qml中的函数
- 解决Ubuntu下Sublime Text 3无法输入中文
- postgres+socket.io+nodejs实时地图应用实践
- Cannot read qmake.conf
- mybatis通过resultMap实现懒加载
- nginx清除缓存ngx_cache_purge
- STAR法则
- iTween研究院之学习笔记Move移动篇
- Spark Worker内部工作原理
- spring security logout(spring security登出示例)
- 再谈数据挖掘——时序预测初探
- 调用系统相册上传头像到服务器
- Oracle 创建 DBLink 的方法
- 关于 Hook Win32 API 的一点研究