UBUNTU下varnish的安装和配置

Jan 20, 2010

环境:UBTUNTU 9.10 ; apache监听173.26.100.214:80 ; varnish监听173.26.100.214:81

1.安装

2.配置

创建cache目录:
mkdir -p /cache/varnish/V && chown -R 777 /cache
编写启动脚本,下面是我的启动脚本:

#!/bin/sh
#file:start.sh
date -u
/usr/local/varnish/sbin/varnishd -a 173.26.100.214:81 -s file,/cache/varnish/V,1024m -f /usr/local/varnish/etc/varnish/default.vcl -p threadpoolmax=1500 -p threadpools=5 -p listendepth=512 -p client_http11=on

在dir/etc/varnish/default.vcl下修改配置,下面是我配置的一部分:

backend default {
.host = "173.26.100.214";
.port = "80";
}     /*apache做后端*/

经测试,varnish做代理的访问速度比squid最快大10倍多

Get In Touch With Us ...