close

來源:http://www.gaojinbo.com/hugwww-varnish4-0-0%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85.html

 

1.环境
centos6.5 64bit
varnish 4.0.0

 

2.安装依赖包
yum install automake autoconf groff libedit-devel libtool ncurses-devel pcre-devel pkgconfig python-docutils

 

3.安装jemalloc
wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
tar xvjf jemalloc-3.6.0.tar.bz2
cd jemalloc-3.6.0
./configure
make
make install

vi /etc/ld.so.conf.d/jemalloc.conf
/usr/local/lib/

ldconfig

 

4.安装varnish
wget https://repo.varnish-cache.org/source/varnish-4.0.0.tar.gz
tar xvzf varnish-4.0.0.tar.gz
cd /root/varnish-4.0.0
./autogen.sh
./configure
make
make install

 

5.配置varnish启动
useradd varnish
cd /root/varnish-4.0.0
cp redhat/varnish.initrc /etc/init.d/varnish
cp redhat/varnish.sysconfig /etc/sysconfig/varnish
cp redhat/varnish_reload_vcl /usr/bin/varnish_reload_vcl
chmod 755 /etc/init.d/varnish
chkconfig varnish on
ln -s /usr/local/sbin/varnishd /usr/sbin/varnishd

vi /etc/sysconfig/varnish
VARNISH_LISTEN_PORT=80
VARNISH_STORAGE_SIZE=24G
VARNISH_TTL=86400

6.配置varnish vcl
配置文件模板:
https://github.com/mattiasgeniar/varnish-4.0-configuration-templates
mkdir /etc/varnish/
cd /root/varnish-4.0.0
cp etc/example.vcl /etc/varnish/default.vcl
vi /etc/varnish/default.vcl

#secret必须配置
vi /etc/varnish/secret
ntage

 

7.启动
service varnish start

完成!

 

arrow
arrow
    文章標籤
    varnish4 centos6 centos5
    全站熱搜
    創作者介紹
    創作者 hmc0316 的頭像
    hmc0316

    hmc0316的部落格

    hmc0316 發表在 痞客邦 留言(0) 人氣()