About a traffic server
Traffic Server is a high performance Web proxy cache can improve network efficiency and performance through information network edge caching frequently accessed. This makes the content closer to the end user physically, while achieving faster delivery and less bandwidth usage. Traffic Server is intended to improve the business, Internet service provider (ISP) by maximizing existing and available bandwidth, content providers and large Intranet backbone of delivery.
Realize the function
As a Web proxy cache
Receiving a user request for Web content as a Web proxy cache, Traffic Server will go to the target Web server (the source server) in these requests. If the Traffic Server that contains the requested content, it provides direct content. If the requested content is not available in the cache, then Traffic Server acts as a proxy: it represents the users to access content from the origin server, and keep a copy in order to meet future requests.
As a reverse proxy
Reverse proxy for external users as if it were the origin server, although it does not generate their own content. Instead, it intercepts the request, according to the rules of the configuration and cache content, providing a cached copy of the requested content itself, or forward the request to the origin server, the content may be returned to the cache for future requests.
Transparent Proxy
Transparent proxy can forward or reverse proxy agent (although almost all of the reverse proxy is transparent deployment), using the network definition function is routed through a proxy sending a request, without self-configured client, and the clients do not usually about over the ability of the agent.
The original server
You want to use a server-generated Traffic Server Agent (and optionally caching) content. In the forward proxy configuration, the source server can be a proxy client attempts to connect to any remote server. In the reverse proxy configuration, the source server is usually a known set of servers, you use Traffic Server as a performance enhancing caching layer.
Forwarding agents
Forward proxy proxy to access external resources, matching block all outbound traffic from the network. Forwarding Agent can be used to accelerate access to external position with slow connections (through the use of a cache and external resources cached copies of those requests directly to service in the future), or may be used to limit or monitor external access.
Two assembling
Use source installation
2.1 Installation depends
pkgconfig libtool gcc (>= 4.3 or clang > 3.0) GNU make openssl tcl pcre libcap flex (for TPROXY) hwloc lua curses (for traffic_top) curl (for traffic_top)
First yum install
[root@vultr ~]# yum -y install pkgconfig libtool gcc make openssl tcl pcre libcap flexhwloc lua curses curl
2.2 Use git to download the source code
Related to the installation package
[root@vultr ~]# yum -y install git autoconf automake
Traffic Server will use the default build nobody users and groups, and install the / opt / ts
Download git repository
[root@vultr ~]# cd /usr/local/src/
[root@vultr src]# git clone https://git-wip-us.apache.org/repos/asf/trafficserver.git
Cloning band switching directory
[root@vultr src]# cd trafficserver/
If the repository is cloned from the Git, you need to configure before continuing to generate scripts
[root@vultr trafficserver]# autoreconf -if
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build/_aux'. libtoolize: copying file `build/_aux/ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build'. libtoolize: copying file `build/libtool.m4' libtoolize: copying file `build/ltoptions.m4' libtoolize: copying file `build/ltsugar.m4' libtoolize: copying file `build/ltversion.m4' libtoolize: copying file `build/lt~obsolete.m4' configure.ac:747: installing 'build/_aux/ar-lib' configure.ac:654: installing 'build/_aux/compile' configure.ac:107: installing 'build/_aux/config.guess' configure.ac:107: installing 'build/_aux/config.sub' configure.ac:46: installing 'build/_aux/install-sh' configure.ac:46: installing 'build/_aux/missing' parallel-tests: installing 'build/_aux/test-driver' example/Makefile.am: installing 'build/_aux/depcomp' configure.ac: installing 'build/_aux/ylwrap'
2.3 Configuration source tree
[root@vultr trafficserver]# ./configure --prefix=/opt/ts
configure: error: in `/usr/local/src/trafficserver': #报错,没有安装C++ configure: error: C++ preprocessor "/lib/cpp" fails sanity check
Install gcc-c ++
[root@vultr trafficserver]# yum -y install gcc-c++
Executed again, shortness error
[root@vultr trafficserver]# ./configure --prefix=/opt/ts
checking checking whether c++ -std=c++17 supports -std=c++17... no configure: error: *** A compiler with support for -std=c++17 is required.
View GCC version
[root@vultr trafficserver]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Three versions of gcc 7.30 compile and install
Download Source Package 3.1
[root@vultr trafficserver]# cd ../
[root@vultr src]# wget https://mirrors.ustc.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
Decompression
[root@vultr src]# tar -xf gcc-7.3.0.tar.gz
3.2 scripts run download_prerequisites
[root@vultr src]# cd gcc-7.3.0
root@vultr gcc-7.3.0]# yum -y install bzip2
[root@vultr gcc-7.3.0]# ./contrib/download_prerequisites
gmp-6.1.0.tar.bz2: OK mpfr-3.1.4.tar.bz2: OK mpc-1.0.3.tar.gz: OK isl-0.16.1.tar.bz2: OK
All prerequisites downloaded successfully.
All intermediate files into the directory
[root@vultr gcc-7.3.0]# mkdir gcc-build-7.3.0
[root@vultr gcc-7.3.0]# cd gcc-build-7.3.0
3.3
[root@vultr gcc-build-7.3.0]# ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
Compilation, long time
[root@vultr gcc-build-7.3.0]# make
Delete the older version of gcc and c ++
[root@vultr gcc-build-7.3.0]# rpm -q gcc [root@vultr gcc-build-7.3.0]# rpm -q gcc-c++ [root@vultr gcc-build-7.3.0]# rpm -e gcc-c++-4.8.5-16.el7_4.2.x86_64 [root@vultr gcc-build-7.3.0]# yum remove gcc
3.4 Installation
[root@vultr gcc-build-7.3.0]# make install
Check Version 3.5
[root@vultr gcc-build-7.3.0]# which gcc
/usr/local/bin/gcc
[root@vultr gcc-build-7.3.0]# gcc --version
-bash: /usr/bin/gcc: No such file or directory
[root@vultr gcc-build-7.3.0]# ln -s /usr/local/bin/gcc /usr/bin/gcc
[root@vultr gcc-build-7.3.0]# gcc --version
gcc (GCC) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Fourth, continue to install apache traffic server
[root@vultr gcc-build-7.3.0]# cd ../../trafficserver/
[root@vultr trafficserver]# ./configure --prefix=/opt/ts
checking whether compiling and linking against OpenSSL works... no configure: error: failed to find OpenSSL
Installation Opsnssl
[root@vultr trafficserver]# yum -y install openssl openssl-devel
[root@vultr trafficserver]# ./configure --prefix=/opt/ts
4.1 compiler
[root@vultr trafficserver]# make
[root@vultr trafficserver]# make check
4.2 Installation
[root@vultr trafficserver]# make install
4.3 forward proxy configuration
In contrast with the reverse proxy, reverse proxy, you want to have a proxy (and optionally cache) of the source server defined list, forward proxy for the agent (and optionally caching) any remote host. Therefore, the following settings are the basic configuration of the minimal forwarding agent:records.config
[root@vultr ~]# cd /opt/ts/
[root@vultr ts]# vim etc/trafficserver/records.config
Minimum CONFIG proxy.config.url_remap.remap_required INT 0 # Disable the presence of re-mapping rule requirements, and Traffic Server match the incoming request before the request to the remote host proxy CONFIG proxy.config.http.cache.http INT 1 # Enable HTTP proxy cache requests. Proxy.config.reverse_proxy.enabled INT CONFIG 0 # disable the reverse proxy
CONFIG proxy.config.http.server_ports STRING 10001 10001: ipv6 # modify the port
4.4 start
[root@vultr ts]# ./bin/trafficserver restart
Stopping traffic_manager: [ OK ]
Stopping traffic_server: [ OK ]
Starting Apache Traffic Server: [ OK ]
[root@vultr ts]# netstat -ntlp
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:10001 0.0.0.0:* LISTEN 21866/traffic_manag tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2756/sshd tcp6 0 0 :::10001 :::* LISTEN 21866/traffic_manag tcp6 0 0 :::22 :::* LISTEN 2756/sshd
4.5 configuration is complete, the client detects
Complete in the configuration agent position
Use cip.cc View IP
Forward proxy configuration successful! ! !