0. Preface
1. Official website http://trafficserver.apache.org/
2. Domestic Community Https://blog.zymlinux.net
3. Simple and Clear configuration: http://blog.csdn.net/tiantiandjava/article/details/50327855I. ATS installation
1. Installing dependent Packages
#yum install pkgconfig libtool gcc make OpenSSL tcl expat Pcre pcre-devel Libcap Flex hwloc Lua Curses Curl Tcl-devel
2. Download the installation package
Download trafficserver-5.3.2
#wget http://apache.fayea.com/trafficserver/trafficserver-5.3.2.tar.bz2
3. Installing ATS
#tar xvf trafficserver-5.3.2.tar.bz2#cd trafficserver-5.3.2#./configure--prefix=/usr/local/ats#make && make Install
Two. Configuration
1.ats configuration files are in the installation directory of Etc/trafficserver, here is/usr/local/ats/etc/trafficserver2. Important Configuration files:
(1). records.config main configuration file, configure the various parameters of ATS
After installation, the item remains the default configuration (2). Remap.config Configure access to the domain name and source
For example, at the end of the document, add
Map Http://domain.com http://113.107.101.126:8111/
The former is the binding domain name, which is the source (3). Storage.config Configuring Disk Caching
In its last increase
/ats_cache 20G
The configuration is to cache the disk cache in the/ats_cache directory with a size of 20G (4). Cache.config Cache Configuration
This file determines the ATS configuration of the cache
Such as
url_regex=192.168.2.105:8112/news.php\?id=.* ttl-in-cache=2h cache-responses-to-cookies=4
Cache-responses-to-cookies Value Introduction
0 do not cache any source server with cookies to return results
1 Cache any results
2 results for cached picture types only
3 Cache all results except the text type
4 Cache all non-text-type returned results, and source server without Set-cookie header or text type with Cache-control:public returns results above URL regular means cache source URL is 192.168.2.105:8112/ News.php?id= the corresponding data for arbitrary results, cached for two hours, provided that the URL does not carry Set-cookie (5). Logs_xml.config Configuration Log Three. Common Configuration 1. Configure the HTTP UI (1). At the end of the Recoreds.config add
CONFIG proxy.config.http_ui_enabled int 3CONFIG proxy.config.http.enable_http_info int 1
(2). Increase in Remap.config
Map Http://localhost/cache-internal/http://{cache-internal}map Http://localhost/cache/http://{cache} @action = Allow @src_ip =127.0.0.1map http://localhost/stat/http://{stat} @action =allow @src_ip =127.0.0.1map http://localhost/ Test/http://{test} @action =allow @src_ip =127.0.0.1map http://localhost/hostdb/http://{hostdb} @action =allow @src_ip =127.0.0.1map http://localhost/net/http://{net} @action =allow @src_ip =127.0.0.1map http://localhost/http/http://{ HTTP} @action =allow @src_ip =127.0.0.1
(3). With the above configuration, HTTP Ui2 can be accessed through the HTTP protocol. Configuration log
(1). ATS default log is squid format does not meet the requirements
(2). Configure Custom Logs
A. Increase in Logs_xml.config
<logformat><name = "Access"/><format = "%<chi>%<cqtq>%<ttms>%<{X-Forwarded-For }cqh>%<crc>/%<pssc>%<pscl>%<cqhm>%<cquuc>%<cqhv>%<phr>/%<pqsi >%<psct> \ "%<{referer}cqh>\" \ "%<{user-agent}cqh>\"%<shn>%<sscl> "/></ Logformat><logobject><format = "Access"/><filename = "Access"/></logobject>
*format the meaning of each delegate, can be https://docs.trafficserver.apache.org/en/5.3.x/admin/working-log-files.en.html To view B. Modify or add the following configuration in Records.config
CONFIG proxy.config.log.squid_log_enabled int 0CONFIG proxy.config.log.custom_logs_enabled int 1
C. Overloaded configuration, which is described later
3. Configure via flag to quickly confirm the file cache status
A.
CONFIG Proxy.config.http.insert_response_via_str INT 2
B. Then look at the head and you can see
via:http/1.1 Localhost.localdomain (apachetrafficserver/5.3.2 [CRS F]) c. View [CRS F], available via URL
Http://trafficserver.apache.org/tools/via#cSsSfD
To view
can also be explained by commands, which are described later
Four. Common commands 1. Commands are usually in the bin directory under the installation directory, this article is/usr/local/ats/bin/
2./usr/local/ats/bin/trafficserver Start #启动
/usr/local/ats/bin/trafficserver Stop #停止
/usr/local/ats/bin/trafficserver restart #停止3. Overloaded configuration
/usr/local/ats/bin/traffic_ctl config reload4. View squid logs
/usr/local/ats/bin/traffic_logcat filename #查看squid日志5./usr/local/ats/bin/traffic_logstats #查看状态
Apache Traffic Server (ATS)