Varnish的CDN推送管理平台搭建

1.获得平台搭建资源,解压,在此之前要安装解压工具,httpd和php,用来识别平台网页文件
yum install unzip httpd php -y
unzip bansys.zip  -d  /var/www/ html

.

2.将解压的文件内容移动到apache默认发布目录
cd /var/www/html/bansys/
[root@server1 bansys]# ls
class_socket.php  config.php  index.php  purge_action.php  static
[root@server1 bansys]# mv * ../
[root@server1 bansys]# ls
[root@server1 bansys]# cd ..
[root@server1 html]# ls
bansys  class_socket.php  config.php  index.php  purge_action.php  static
[root@server1 html]# rm -rf bansys/
[root@server1 html]# ls
class_socket.php  config.php  index.php  purge_action.php  static
3.编辑config.php

在这里插入图片描述

4.修改http端口,(varnish服务已占用80端口)

vim /etc/httpd/conf/httpd.conf
Listen 8080

5.修改推送平台的配置文件

90 acl taylor {
91 “127.0.0.1”;
92 “172.25.61.0”/24;
93 }
94 backend web1 {
95 .host = “172.25.61.2”;
96 .port = “80”;
97 }
98
99 backend web2 {
100 .host = “172.25.61.3”;
101 .port = “80”;
102 }
103 director lb round-robin {
104 { .backend = web1; }
105 { .backend = web2; }
106 }
107 sub vcl_recv{
108 if (req.request == “BAN”) {
109 if (!client.ip ~ west) {
110 error 405 “Not allowed.”;
111 }
112 ban("req.url ~ " + req.url);
113 error 200 “ban added”;
114 }
115 }
116 sub vcl_recv {
117 if (req.http.host ~ “^(www.)?west.org”) {
118 set req.http.host = “www.westos.org”;
119 set req.backend = lb;
120 return (pass);
121 } elsif (req.http.host ~ “^bbs.west.org”) {
122 set req.backend = web2;
123 } else {error 404 “westos cache”;
124 }
125 }
128 sub vcl_deliver {
129 if (obj.hits >0 ){
130 set resp.http.X-Cache = “HIT from westos cache”;
131 }
132 else {
133 set resp.http.X-Cache = “MISS from westos cache”;
134 }
135 return (deliver);
136 }

5.重新加载配置

/etc/init.d/varnish reload
/etc/init/httpd start

6.测试

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
推送成功

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值