git clone https://github.com/apache/trafficserver.git
首先阅读README,
安装ATS时依赖包如下:
GCC 4.2.4 compiler suite (ports collection)
autoconf
automake
pkgconfig
libtool
tcl
expat
openssl
pcre
以上包可以通过brew进行安装;另外还可能需要安装cmake;将以上包安装完成之后,可以继续参考INSTALL里面的说明进行生成configure文件
点击(此处)折叠或打开
- autoreconf -if
在OSX下面的环境,接下来就会生成configure,生成了configure以后和下载的压缩包的安装方法以后是一样的;
./configure —prefix=/usr/local/ats
如果想要编译example下面的插件代码样例并安装的话,可以加参数
--enable-example-plugins
配置命令如下:
点击(此处)折叠或打开
- ./configure —prefix=/usr/local/ats/ --enable-example-plugins && make && make install
安装完毕;
Apache Traffic Server的主要配置文件为/usr/local/ats/etc/trafficserver/records.config
将里面的端口修改为希望监听的端口,
点击(此处)折叠或打开
- CONFIG proxy.config.http.server_ports STRING 80
然后修改/usr/local/ats/etc/trafficserver/remap.config
将访问的http server映射到源站即可
点击(此处)折叠或打开
- map http://www.demo.com/ http://192.168.100.5/
接下来访问以下http://www.demo.com看一下内容