lighttpd-1.4.19缓存模块mod_cache安装配置
模块不是官方自带,需要手工下载。
插件下载页面:http://www.linux.com.cn/modcache/
wget http://www.linux.com.cn/modcache/lighttpd-1.4.19.modcache.v.1.6.0.patch
# patch -p0 < lighttpd-1.4.19.modcache.v.1.6.0.patch
# sh autogen.sh
配置:
"mod_cache",
"mod_proxy",
cache.bases=("/data/cache")
cache.enable = "enable"
cache.domains = ("zhangjianfeng.com$")
cache.support-queries = "enable"
cache.purge-host = "^(192\.168\.|218\.50\.15\.)"
cache.refresh-pattern = (
"/$" => “5 update-on-refresh no-expire-header”,
“\.(?i)(flv)$” => “0 fetchall-for-range-request flv-streaming”,
“\.(?i)(js|css|xml)$” => “240″,
“\.(?i)(htm|html|shtml)$” => “30″,
“\.(?i)(jpg|bmp|jpeg|gif|png)$” => “2880″,
“\.(?i)(rar|zip|wmv|avi|mp3|ape|rm|mpeg|mpg|wma|asf|rmvb|flv)$” => “0 fetchall-for-range-request”,
“.” => “30 update-on-refresh”
)
proxy.server = ( “/” =>
(
( “host” => “192.168.25.101″, “port” => 81 ) # real backend http server ip and port
)
)
proxy.worked-with-mod-cache = “enable”
注: 这个模块在接受用户请求后, 需要先去真实服务器把文件完整下载到本地硬盘,才向用户返回数据. 这样假如源始文件比较大的情况下,用户等待的时候会比较长. 另外作者出于设计的简单性,这个模块并不能有效的利用内存.
来自:http://blog.zhangjianfeng.com/article/1186