标签:
安装pcre
varnish 依赖pcre进行url正则匹配。
cd pcre-8.12
./configure --prefix=/usr/local/
make&&make install
编译
解压缩varnish源码包
wget http://repo.varnish-cache.org/source/varnish-3.0.4.tar.gz
cd /root
tar -zxvf varnish-3.0.4.tar.gz
cd varnish-3.0.4
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure --prefix=/usr/local/varnish
make && make install
配置文件路径vim /usr/local/varnish/etc/varnish/default.vcl
ln -s /usr/local/varnish/sbin/varnishd /usr/bin/varnishd
vim /usr/local/varnish/etc/varnish/default.vcl
#去掉注释
backend default {
.host = "192.168.66.139";
.port = "80";
}
#启动varnish
varnishd -f /usr/local/varnish/etc/varnish/default.vcl -s file,/var/varnish_cache,1G -T 0.0.0:2000 -a 0.0.0.0:80
http://192.168.66.140/
返回头信息:
Accept-Ranges:bytes
Age:0
Connection:keep-alive
Content-Length:10
Content-Type:text/html; charset=UTF-8
Date:Fri, 03 Jun 2016 08:34:41 GMT
ETag:"c0672-a-53433d4d6ce32"
Last-Modified:Wed, 01 Jun 2016 09:08:22 GMT
Server:Apache/2.2.15 (CentOS)
Via:1.1 varnish
X-Varnish:977689110
安装成功!
标签:
原文地址:http://www.cnblogs.com/maxomnis/p/5556782.html