varnish:取代Squid的高性能开源HTTP加速器Varnish配置教程来源: 发布时间:星期日, 2009年1月4日 浏览:14次 评论:0
源码包编译安装:
cd /usr/local/src && wgethttp://nchc.dl.sourceforge.net/sourceforge/varnish/varnish-1.1.1.tar.gz tar zxvf /usr/local/src/varnish-1.1.1.tar.gz cd /usr/local/src/varnish-1.1.1 ./autogen.sh ./configure --enable-debugging-symbols --enable-developer-warnings --enable-dependency-tracking 注:如果你 ![]() ![]() ![]() ![]() ![]() ![]() ![]() 我这里是用源码包安装 ![]() ![]() 2. 建立cache目录: mkdir -p /cache/varnish/V && chown -R nobody:nobody /cache 3.编写启动文件: cd /usr/local/varnish/sbin vi start.sh 内容如下: #!/bin/sh # file: start.sh date -u /usr/local/varnish/sbin/varnishd \ -a 10.0.0.129:80 \ -s file,/cache/varnish/V,1024m \ -f /usr/local/varnish/sbin/vg.vcl.default \ -p thread_pool_max=1500 \ -p thread_pools=5 \ -p listen_depth=512 \ -p client_http11=on \ 注:-a 是指定后端服务器 ![]() ![]() ![]() 不过这个也可以在vcl里面写 ![]() -f 是指定所用 ![]() ![]() ![]() -s 指定cache目录 ![]() ![]() ![]() -p 是指定varnish ![]() ![]() ![]() ![]() ![]() ![]() ![]() 其他参数已经参数 ![]() ![]() 4.编写vcl: 我 ![]() backend default { ![]() ![]() } #我用 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 写上对应 ![]() ![]() ![]() sub vcl_recv { ![]() pipe; } ![]() pipe; } ![]() pass; } ![]() ![]() ![]() lookup; } lookup; } sub vcl_pipe { pipe; } sub vcl_pass { pass; } sub vcl_hash { hash; } sub vcl_hit { ![]() pass; } deliver; } sub vcl_timeout { discard; } sub vcl_discard { discard; } 如果是多个站点在区别 ![]() ![]() backend www { ![]() ![]() } backend images { ![]() ![]() } sub vcl_recv { ![]() ![]() ![]() } els ![]() ![]() } ![]() error 404 "Unknown virtual host"; } 5.启动varnish: /usr/local/varnish/sbin/start.sh Mon Sep 3 03:13:19 UTC 2007 file /cache/varnish/V/varnish.tEKXXx (unlinked) size 1073741824 ![]() Using old SHMFILE ps waux | grep varnish root 16254 0.0 0.0 11200 708 ? Ss 10:43 0:00 /usr/local/varnish/sbin/varnishd -a 10.0.0.129:80 -s /varnish/V,1024m -f /usr/local/varnish/sbin/vg.vcl.default -p thread_pool_max 1500 -p thread_pools 5 -p listen_depth 512 -p client_http11 _disibledevent="_blank">高性能 0
相关文章读者评论发表评论 |
|