1. ats 安装

参考:https://docs.trafficserver.apache.org/en/latest/getting-started/index.en.html#installation

可执行文件目录:/usr/bin/

配置文件目录:/etc/trafficserver/

日志文件目录:/var/log/trafficserver/

ats 的启动、重启、停止

 [root@localhost ~]# ls /usr/bin/ | grep traffic
traffic_cop
traffic_crashlog
traffic_ctl
traffic_layout
traffic_line
traffic_logcat
traffic_logstats
traffic_manager
traffic_sac
trafficserver
traffic_server
traffic_via
[root@localhost ~]# trafficserver start  # 启动
Starting Apache Traffic Server: [ 确定 ]
[root@localhost ~]# trafficserver restart  # 重启
Stopping traffic_cop: [ 确定 ]
Stopping traffic_manager: [ 确定 ]
Stopping traffic_server: [ 确定 ]
Starting Apache Traffic Server: [ 确定 ]
[root@localhost ~]# netstat -tlnp | grep traffic
tcp 0.0.0.0: 0.0.0.0:* LISTEN /traffic_manage
tcp 127.0.0.1: 0.0.0.0:* LISTEN /traffic_manage
tcp 127.0.0.1: 0.0.0.0:* LISTEN /traffic_server
[root@localhost ~]# trafficserver stop  # 停止
Stopping traffic_cop: [ 确定 ]
Stopping traffic_manager: [ 确定 ]
Stopping traffic_server: [ 确定 ]

2. ats 的配置文件

records.config          是 key-value 格式的配置文件,负责大部分全局的选项设置,即主配置文件。

storage.config          用于指定磁盘存储。

remap.config            定义映射规则,用于请求的重写(rewrite),反向代理即在此配置。

logs_xml.config   日志配置文件。

3. ats 的反向代理配置

在代理服务器 192.168.233.134 作如下配置

vim /etc/trafficserver/records.config

 ##############################################################################
# Enable / disable HTTP caching. Useful for testing, but also as an
# overridable (per remap) config
##############################################################################
CONFIG proxy.config.http.cache.http INT 1 ##############################################################################
# Specify server addresses and ports to bind for HTTP and HTTPS. Docs:
# https://docs.trafficserver.apache.org/records.config#proxy-config-http-server-ports
##############################################################################
CONFIG proxy.config.http.server_ports STRING 80  # 默认端口为 8080 ##############################################################################
# These settings control remapping, and if the proxy allows (open) forward proxy or not. Docs:
# https://docs.trafficserver.apache.org/records.config#url-remap-rules
# https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
##############################################################################
CONFIG proxy.config.url_remap.remap_required INT 1
# https://docs.trafficserver.apache.org/records.config#proxy-config-url-remap-pristine-host-hdr
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
# https://docs.trafficserver.apache.org/records.config#reverse-proxy
CONFIG proxy.config.reverse_proxy.enabled INT 1

vim /etc/trafficserver/remap.config

regex_map http://(.*)/ http://192.168.233.130:8000/

vim /etc/trafficserver/storage.config

/var/cache/trafficserver 256M

在 192.168.233.130:8000 开启一个 python 程序,代码如下

 import tornado.ioloop
import tornado.web class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("<h1>Hello, world</h1>") def make_app():
return tornado.web.Application([
(r"/", MainHandler),
]) if __name__ == "__main__":
app = make_app()
app.listen(8000)
tornado.ioloop.IOLoop.current().start()

在客户端 192.168.233.1 访问 192.168.233.134

Apache Traffic Server的更多相关文章

  1. Apache Traffic Server服务搭建

    一.简介 Apache Traffic Server(ATS或TS)是一个高性能的.模块化的HTTP代理和缓存服务器,与 Nginx 和 Squid 类似.它通过将频繁访问的信息缓存在网络的边缘来改善 ...

  2. Apache Traffic Server 5.3.1公布

    本文来源于我在InfoQ中文站翻译的文章,原文地址是:www.infoq.com/cn/news/2015/07/traffic-server-5.3.1-release 近日,Apache软件基金会 ...

  3. 安装ATS(apache traffic server)正向代理

    一 traffic server简介 Traffic Server是一种高性能Web代理缓存,可通过在网络边缘缓存频繁访问的信息来提高网络效率和性能.这使内容在物理上更接近最终用户,同时实现更快的交付 ...

  4. Apache Traffic Server(ats)

    零.前言1.官网 http://trafficserver.apache.org/2.国内社区 https://blog.zymlinux.net3.简洁明了的配置:http://blog.csdn. ...

  5. apache traffic server安装

    wget http://mirrors.hust.edu.cn/apache/trafficserver/trafficserver-7.1.1.tar.bz2 tar -jxvf trafficse ...

  6. ATS (apache traffic server) http_ui 设置与使用

    参考官方FAQ进行设置: https://cwiki.apache.org/confluence/display/TS/FAQ#FAQ-http_ui 这里也有一篇: https://blog.zym ...

  7. Using Apache Web Server with Jboss AS 7

    In real-world projects, it's common to find Apache web server as a front door to your application se ...

  8. tomcat集群学习记录1--初识apache http server

    起因 平时开发的时候我都是用eclipse把代码部署到本地tomcat的,当然只会去跑1台tomcat啦... 偶尔有时候解决问题需要去公司测试环境找日志.连上公司测试环境以后发现竟然有2台weblo ...

  9. Apache http Server 2.4 安装与配置

    前言 Apache官网从2.2之后,不再提供windows的msi或exe安装版本,现在Apache http Server有两个分支2.2及2.4 注意事项 如果之前有安装2.2的版本,请先卸载 A ...

随机推荐

  1. [UE4]重构Grab和Drop

    一.在前面的实例中是把Grab和Drop逻辑放到SimVRHand手柄对象里面,从面向对象来看,Grab和Drop逻辑应该放在被抓取的对象中,因为可能每个对象被抓取后要执行的Grab和Drop逻辑都不 ...

  2. sklearn错误

    1.No module named 'sklearn.cross_validation' sklearn.cross_validation会报错,关键在于新版本的sklearn没有cross_vali ...

  3. Servlet-Context学习笔记

    介绍 ServletContext其实就是全局作用域对象, 上下文环境对象 利用context可以实现对,当前网站中所有的Servlet共享数据 context对象只能由Tomcat负责创建,在tom ...

  4. connected standby

    参考链接 https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby http ...

  5. factory di

    services.AddScoped(typeof(Test)); //services.AddScoped<Test>() // .AddScoped<ITest, Test> ...

  6. 关于js-xlsx的简单使用

    关于js-xlsx的简单使用 最近要做一个东西用到对excel的操作,就是在前端将excel加载进来,操作后再生成excel,在网上找了很多种办法,能够实现的demo是下面这个: 纯前端利用 js-x ...

  7. Linux下Oracle开机启动

    参考:http://blog.csdn.net/huangyanlong/article/details/36942155 一.保证dbstart能用:vi $ORACLE_HOME/bin/dbst ...

  8. mysql数据库的理解

    1.索引结构原理: 普通的Btree(binary search tree)就是二叉树,如下图 B+ Tree索引类型则是二叉树的升级版,每个节点存的是 <num ,最后存排序的ROWID Ha ...

  9. 71.纯 CSS 创作一个跳 8 字型舞的 loader

    原文地址:https://segmentfault.com/a/1190000015534639#articleHeader0 感想:rotateX() 和rotateZ()一起使用好懵呀. HTML ...

  10. python shutil模块&random模块

    shutil模块 import shutil shutil.copyfileobj(open("os_.py", "r"), open("os_2.p ...