varnish测试起步

今天在redhat上装个varnish试一试。


$ wget http://repo.varnish-cache.org/source/varnish-3.0.2.tar.gz
$ tar -zxvf varnish-3.0.2.tar.gz
$ cd varnish-3.0.2
如果没configure,就
$ ./autogen.sh


然后生成makefile
$ ./configure --enable-debugging-symbols --enable-developer-warnings --enable-dependency-tracking


成功后直接
$ ./make
$ ./make install
就这样装好了,看安装目录文件
[root@smartcache1 varnish]# ll
total 28
drwxr-xr-x 2 root root 4096 Feb  3 15:54 bin
drwxr-xr-x 3 root root 4096 Feb  3 15:54 etc
drwxr-xr-x 3 root root 4096 Feb  3 15:54 include
drwxr-xr-x 4 root root 4096 Feb  3 15:54 lib
drwxr-xr-x 2 root root 4096 Feb  3 15:54 sbin
drwxr-xr-x 3 root root 4096 Feb  3 15:54 share
drwxr-xr-x 3 root root 4096 Feb  3 15:54 var


装好了还是先测试一下,先到sbin先测试之:
[root@smartcache1 sbin]# ./varnishd -V
varnishd (varnish-3.0.2 revision 55e70a4)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS


看来是正常了,来编辑配置
[root@smartcache1 varnish]# vi default.vcl 


修改如下:
# backend default {
#     .host = "127.0.0.1";
#     .port = "8080";
# }


为:
backend default {
    .host = "127.0.0.1";
    .port = "80";
}


这个就是说后端代理连接的是127.0.0.1(就是本机)上的80的web server,这个是我上面配置的apache web server。
运行如下命令,让varnish跑起来:
[root@smartcache1 sbin]# ./varnishd -f ../etc/varnish/default.vcl -s malloc,50m -T 127.0.0.1:200 -a 0.0.0.0:80800


还是看一下跑起来没:
[root@smartcache1 sbin]# ps -ef | grep varnishd 
root      5726     1  0 16:12 ?        00:00:00 ./varnishd -f ../etc/varnish/default.vcl -s malloc,50m -T 127.0.0.1:200 -a 0.0.0.0:80800
nobody    5727  5726  0 16:12 ?        00:00:00 ./varnishd -f ../etc/varnish/default.vcl -s malloc,50m -T 127.0.0.1:200 -a 0.0.0.0:80800
root      5910 30186  0 16:12 pts/1    00:00:00 grep varnishd


看来还是跑起来了啊!最后就只是设置浏览器设置代理访问测试一下就OK了!我反正测试是正常的!


在./configure --enable-debugging-symbols --enable-developer-warnings --enable-dependency-tracking的时候出现如下错误:
checking pkg-config is at least version 0.9.0... yes
checking for PCRE... no
configure: error: Package requirements (libpcre) were not met:
No package 'libpcre' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables PCRE_CFLAGS
and PCRE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.


如果没装pcre就装pcre,然后执行之就OK了!
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值