分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]
Apr 23
原来网站上一直使用nginx的代理缓存,确实能给服务器节省大量的性能。能将大部分的页面进行缓存,但最近一段时间,发现并没有像以前那样将文件进行缓存。在经过检查后,发现原来 proxy_cache是对头信息有限制的。

http://wiki.nginx.org/HttpProxyModule#proxy_cache

引用
The cache depends on proxy buffers, and will not work if proxy_buffers is set to off.

The following response headers flag a response as uncacheable unless they are ignored:
    Set-Cookie
    Cache-Control containing "no-cache", "no-store", "private", or a "max-age" with a non-numeric or 0 value
    Expires with a time in the past
    X-Accel-Expires: 0


proxy_cache受几个因素影响:
1,proxy_buffers必须启动,否则将不能使用缓存
2,如果头信息存在以下的情况,缓存将会被忽略。
    有Set-Cookie
    Cache-Control的内容包含: "no-cache", "no-store", "private", or a "max-age" 是0
    Expires 设置的时间一个过期的时间
    X-Accel-Expires: 0

经过分析,原来程序中有一个程序修改后,默认所有页面都会传出一个Set-Cookie的值,这个值引起页面一直没有行缓存。从而使用页面服务器一直很慢。
Apr 23
在linux下批量删除缓存文件真是一个很麻烦的事。网上有人说用rsynx进行批量删除。
但是在我的实践过程中,这个方法,实际上也不好使,而且效率比rm的效率要低。

最后还是使用rm进行删除文件。
nohup rm -rfv ./cache.bak &
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]