CentOS 5下安装Varnish 3.0

Varnish是一款高性能的开源HTTP加速器,挪威最大的在线报纸 Verdens Gang 使用3台Varnish代替了原来的12台squid,性能居然比以前更好。

Varnish 的作者Poul-Henning Kamp是FreeBSD的内核开发者之一,他认为现在的计算机比起1975年已经复杂许多。在1975年时,储存媒介只有两种:内存与硬盘。但现在计算 机系统的内存除了主存外,还包括了cpu内的L1、L2,甚至有L3快取。硬盘上也有自己的快取装置,因此squid cache自行处理物件替换的架构不可能得知这些情况而做到最佳化,但操作系统可以得知这些情况,所以这部份的工作应该交给操作系统处理,这就是 Varnish cache设计架构。

1.  Varnish官网  https://www.varnish-cache.org/

2.  获得源码    wget 

3.

tar zxvf varnish-3.0.0-beta2.tar.gz
cd varnish-3.0.0-beta2
./configure --prefix=/usr/local/varnish
make && make install

会报  No package 'libpcre' found   错误,  执行   yum install pcre-devel  解决。

4. 修改 /usr/local/varnish/etc/varnish/default.vcl

#
 backend default {
     .host = "10.146.87.240"; //缓存没有找到,然后转向的服务器
     .port = "80";
 }

5. 启动

/usr/local/varnish/sbin/varnishd -f /usr/local/varnish/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000


默认监听的是 80端口

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://127.0.0.1/wyyjfz.html