💗心爱的💗-小沨

  • 首页
  • 网盘
  • 图床
  • 赞助
  • 关于本站
私人小天地
谈天说地,学习笔记
  1. 首页
  2. Linux系统
  3. 正文

directadmin安装Varnish缓存记录笔记.

2014年6月28日 2990点热度 0人点赞 0条评论

资料来源jybb.me和zmrbk.com

组件装一下吧:

$ yum -y install automake autoconf libtool ncurses-devel libxslt groff pcre-devel pkgconfig
$ apt-get install automake autoconf libtool ncurses-devel libxslt groff pcre-devel pkgconfig

添加varnish官方源并安装

debian和ununtu

$ curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -
$ echo "deb http://repo.varnish-cache.org/debian/ squeeze varnish-3.0" >> /etc/apt/sources.list
$ apt-get update
$ apt-get install varnish

CentOS 5

$ rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release/varnish-release-3.0-1.el5.centos.noarch.rpm

Centos6

$ rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm

开始安装好 Varnish:

centos $ yum -y install varnish ##  
debian or ubuntu $ apt-get install varnish

修改各个配置.
命令里面有“1.2.3.4”请把它改为你服务器的 IP:

sed -i 's/.port = "80";/.port = "8080";/g' /etc/varnish/default.vcl
sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf
sed -i 's///g' /etc/httpd/conf/extra/httpd-vhosts.conf
mkdir /usr/local/directadmin/data/templates/custom
cp -p /usr/local/directadmin/data/templates/virtual_host2.conf /usr/local/directadmin/data/templates/custom/virtual_host2.conf
cp -p /usr/local/directadmin/data/templates/virtual_host2_sub.conf /usr/local/directadmin/data/templates/custom/virtual_host2_sub.conf
cp -p /usr/local/directadmin/data/templates/redirect_virtual_host.conf /usr/local/directadmin/data/templates/custom/redirect_virtual_host.conf
sed -i 's///g' /usr/local/directadmin/data/templates/custom/*
sed -i 's/VARNISH_LISTEN_PORT=6081/VARNISH_LISTEN_PORT=80/g' /etc/sysconfig/varnish

安装 rpaf 获取真实 IP.
Apache 2.2 安装方法:

wget http://www.stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar xzf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
apxs -cia mod_rpaf-2.0.c

Apache 2.4 安装方法:

wget http://www.stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar xzf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
yum -y install git
git clone git://gist.github.com/2716030.git
patch mod_rpaf-2.0.c 2716030/mod_rpaf-2.0.c.patch
apxs -cia mod_rpaf-2.0.c

安装好 rpaf 之后要修改 http 引入的配置:

vi /etc/httpd/conf/extra/httpd-includes.conf

在最底下加入如下代码:

#For the rpaf

RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1
RPAFheader X-Forwarded-For

DirectAdmin 更新一下配置:

echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

最后:重启 Apache 与 Varnish,并设置开机启动.

service httpd restart
service varnish start
chkconfig varnish on
标签: DirectAdmin Varnish 缓存
最后更新:2014年6月28日

mikj

这个人很懒,什么都没留下

打赏 点赞
< 上一篇
下一篇 >

文章评论

您需要 登录 之后才可以评论
站内搜索
联系我
分类
  • AI智能
  • Android
  • Linux系统
  • VPS服务器
  • windows系统
  • wordpress
  • 域名相关
  • 建站分享
  • 教程学习
  • 数据库类
  • 旅行点滴
  • 未分类
  • 网络服务
  • 资源分享
  • 跨境出海
  • 金融投资
友情链接
  • 我喔喔喔
  • Shucheng Li
  • 天下无鱼
  • 李子博客
  • semnew
  • 我的图库
  • QQTM论坛
  • 爱购啦
  • 轨迹博客
  • 死老鬼
  • 朱志瑞
  • 光的魔术师
  • 傻子-跸西的blog
  • 陈否否
  • 麦麦同学
  • 夜狐
  • 小沨记事本
  • 寥寥后花园
  • 怪鸟博客
  • QQPCC
  • 豆博
  • LINUX DO
  • 娃娃博客
  • 撸羊毛
  • vzone

COPYRIGHT © 2025 Xinai.De. ALL RIGHTS RESERVED.@ 网站运行:@ 服务器运行状态

Theme Kratos Made By Seaton Jiang