varnish安装

通过varnish 缓存服务器可以完成事:

    使用varnish 加速后端Apache Web服务

    使用varnishadm管理缓存页面  ?

    使用varnishstat查看varnish状态?

使用3台centos6.7虚拟机 一台web服务器(tpl02), 一台作为varnish代理服务器(tpl01), 客户机(client)

workNAT29.153\\使用浏览器yw003varnish加速web\
tpl01NAT29. 150varnish(源码)/etc/sysconfig/varnish       /etc/varnish/default.vcl  提供代理服务yw003varnish加速webvarnish-3.0.6
tpl02NAT29.152httpd(yum)\提供web服务yw003varnish加速webhttpd-2.2.15-60.el6.centos.6.x86_64


步骤一: 构建web服务器(tpl02)

1. 使用yum安装web软件包

     yum -y install httpd

     rpm -q httpd

2. 启用httpd服务,并设为开机自动运行

    service httpd restart; chkconfig httpd on

    netstat -anptu | grep httpd

3. 在/var/www/html下创建一个名为index.html的首页文件

步骤二: 部署varnish服务器(tpl01)

1. 编译安装软件

     yum -y install readline-devel  pcre-devel

     yum -y install libtool automake python-docuitls

    useradd -s /sbin/nologin varnish

   tar -xvf  varnish-3.0.6.tar.gz

   cd varnish-3.0.6

   ./autogen.sh

   ./configure --prefix=/usr/local/varnish

   make

   make install

 2. 复制启动脚步及配置文件

   cp redhat/varnish.initrc /etc/init.d/varnish

  cp redhat/varnish.sysconfig  /etc/sysconfig/varnish

  cp redhat/varnish_reload_vcl  /usr/bin/

  ln -s /usr/local/varnish/sbin/varnishd /usr/sbin/

3.修改varnish文件

  vim /etc/sysconfig/varnish

    varnish_vcl_conf=/etc/varnish/default.vcl

    varnish_listen_port=80

    varnish_secret_file=/etc/varnish/secret

     varnish_storage_size=64M

      varnish_storage="malloc,${VARNISH_STORAGE_SIZE}"

4. 修改代理配置文件

  115  mkdir /etc/varnish

  116  cp /usr/local/varnish/etc/varnish/default.vcl /etc/varnish/

  117  uuidgen > /etc/varnish/secret

  118  vim /etc/varnish/default.vcl

backend default {

    .host = "192.168.29.152"

    .port= "80"

}

service varnish start //注意查看80是否被占用

netstat -anptu | grep varnish

步骤三: 客户端浏览器测试(work)

cat /etc/hosts

192.168.29.150  web.liang.com

firefox http://web.liang.com



   







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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值