码迷,mamicode.com
首页 > 其他好文 > 详细

varnish安装

时间:2016-06-03 17:22:45      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

安装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

  安装成功!

 

varnish安装

标签:

原文地址:http://www.cnblogs.com/maxomnis/p/5556782.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!