Centos 7 上 源码安装和配置 ATS 9.1.2

1、安装依赖包:

yum -y install Git gcc gcc-c++ autoconf automake libtool pkgconfig pcre-devel tcl-devel expat-devel openssl-devel xz-devel boost-devel curl curl-devel ncurses ncurses-devel yum -y install perl-ExtUtils-MakeMaker yum -y install libcap libcap-devel hwloc hwloc-devel yum -y install libunwind libunwind-devel

 

2、下载源码软件包并安装

#定义ATS的运行目录 mkdir /usr/local/ats #使用ats 用户运行ATS,方便后期管理,用户家目录也指定到 ATS运行目录下 id ats &>/dev/null || /usr/sbin/useradd -u 176 -r ats -s /sbin/nologin -d /usr/local/ats/ #下载源码包 wget https://dlcdn.apache.org/trafficserver/trafficserver-9.1.2.tar.bz2 #编译安装(使用debug模式运行,便于发现和调试问题。开启debug模式) yum -y install bzip2 #解压时需要用到 tar jxvf trafficserver-9.1.2.tar.bz2 cd trafficserver-9.1.2 #在使用 ./configure 处理时会报错,需要C++17的支持 yum install centos-release-scl yum-config-manager --enable rhel-server-rhscl-7-rpms yum install devtoolset-7 scl enable devtoolset-7 bash #切换C++版本后运行 ./configure ./configure --prefix=/usr/local/ats --with-user=ats --with-group=ats --enable-debug --enable-example-plugins --enable-experimental-plugins make make install

3、配置:具体配置请查看官网说明:

https://docs.trafficserver.apache.org/en/9.1.x/getting-started/index.en.html#configuration

 根据官网总结一下基础配置: 配置文件都在:/usr/local/ats/etc/trafficserver 下

  I、启用反向代理

    # vim records.config 

CONFIG proxy.config.http.cache.http INT 1 #启用代理HTTP请求的缓存 CONFIG proxy.config.reverse_proxy.enabled INT 1 #启用反向代理的支持 CONFIG proxy.config.url_remap.remap_required INT 1 CONFIG proxy.config.url_remap.pristine_host_hdr INT 1 #保持客户端请求的完整头部信息。 CONFIG proxy.config.http.server_ports STRING 8080 8080:ipv6 #根据业务情况设置代理端口

  II、配置映射  # https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/files/remap.config.en.html#std-configfile-remap.config

    # vim remap.config

map http://www.acme.com/ http://localhost:8080/ map https://static.acme.com/ https://origin-static.acme.com/
使用regex_前缀表示该行具有正则表达式 (regex)。 regex_map http:///^www(0[0-0][0-5]).acme.com/ http://localhost:8080/

  III、如果代理https ,还需要配置证书

    # vim ssl_multicert.config

dest_ip=* ssl_cert_name=/path/to/secret/privatekey/acme.rsa

  IV、调整缓存参数

    # vim storage.config

      /cache/trafficserver 500G     #缓存目录自定义,可以使用新硬盘

  V、缓存存储、清理缓存

    # https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/storage/index.en.html

 

  VI、日志配置

    # https://docs.trafficserver.apache.org/en/9.1.x/admin-guide/logging/understanding.en.html

4、启动服务

cd /usr/local/ats/bin/ ./trafficserver start

 

 

5、验证

# ./traffic_top      #查看ATS 运行状况

 


__EOF__

本文作者语 默
本文链接https://www.cnblogs.com/weijie0717/p/16203836.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   语~默  阅读(303)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示