CDN初学搭建(ats)

CDN初学搭建(ats)

一、 CDN初学搭建

准备vagrant virtualbox 内部环境测试所需包

一、vagrant创建启动虚拟机

1 mkdir /cdn 创建cdn目录,将开发环境所需包拷贝到此目录
2 初始化开发环境,vagrant init XXX.base ,将会生成Vagrantfile,此文件可以根据自身环境按需修改(此处省略)

1.1vagrant 添加一个本地box

  1. root@liuqiang:/cdn# vagrant box add ats1 ats1_dev.box 
  2. ==> box: Box file was not detected as metadata. Adding it directly... 
  3. ==> box: Adding box 'ats1' (v0) for provider: 
  4. box: Unpacking necessary files from: file:///cdn/ats1_dev.box 
  5. ==> box: Successfully added box 'ats1' (v0) for 'virtualbox'

1.2 将添加好的box开机,此时看到显示正常。

enter description here

enter description here

1.3 此时在virtualbox能看到创建的虚拟机ats

enter description here

enter description here

二、访问ats没有映射的url

登录ats1

  1. root@liuqiang:/cdn# vagrant ssh ats1 
  2. Last login: Fri Jun 23 02:13:44 2017 from 10.0.2.2 

执行sudo -i 获取root权限

  1. [vagrant@localhost ~]$ sudo -i 
  2. [root@localhost ~]# 

进入/home/ats目录,执行“./bin/trafficserver start”启动ats

  1. [root@localhost ats]# ./bin/trafficserver start 
  2. Starting Apache Traffic Server: [ OK ] 

执行“curl -v -x '127.0.0.1:8080' 'www.sohu.com' | more”通过ats代理访问www.sohu.com

#####预期结果

查看Log文件,最近一行提示404错误:

enter description here

enter description here

三、测试修改源站配置添加url

预置条件: 用例10001, 10002 已执行成功,
测试步骤: 1、执行vagrant ssh ats1登录虚拟机
2、执行sudo -i 获取root权限
3、进入/home/ats目录,执行“./bin/trafficserver start”启动ats
4、打开配置文件./etc/trafficserver/remap.config,
在文件中增加一行“map http://www.sohu.com http://www.sohu.com
5.执行“./bin/traffic_ctl config reload”重新加载配置
6.执行“curl -v -x '127.0.0.1:8080' 'www.sohu.com' | more”

通过ats代理访问www.sohu.com

3.1查看Log文件,最近一行中返回值为200,页面内容正常返

enter description here

enter description here

备注:第四部中的第二个“http://www.sohu.com”为目标地址,此处可以替换成自己的源站

转载于:https://www.cnblogs.com/luckyall/p/7606050.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值