Nginx 缓存服务

常见缓存类型


缓存配置语法

缓存配置实践
1  | CentOS7.4 Nginx Proxy 172.17.70.227  | 
web 节点准备
1  | # 目录建立  | 
启动三个端口监听
1  | [root@nginx conf.d]# vim web_node.conf  | 
1  | [root@nginx code1]# curl 172.17.70.226:8081/url1.html  | 
代理配置缓存
1  | # 创建缓存目录  | 
1  | [root@proxy conf.d]# nginx -t  | 
客户端测试
1  | 


1  | # 查看缓存内容:  | 
Nginx 清理缓存方式
1  | [root@proxy /]# cd /soft/cache/  | 
1  | # curl 测试缓存  | 
ngx_cache_purge 扩展模块清理
部分页面 不缓存
指定部分页面 不参加 proxy_Cache 缓存
1  | [root@proxy conf.d]# vim proxy_cache.conf  | 
1  | # 清理缓存  | 
缓存日志 记录统计
1  | # 修改/etc/nginx/nginx.conf中log_format格式  | 
1  | # 修改proxy_cache.conf,在server标签新增access⽇志  | 

1  | [root@proxy soft]# nginx -s reload  | 

nginx cache 查看命中率
1  | http://www.361way.com/nginx-cache/2665.html  | 
Nginx 缓存总结
1  | 1. 缓存的分类:  | 
