Apache Traffic Server is great tool to use as reverse proxy or caching proxy server to increase performance of site. This article will guide you to how to Setup Apache Traffic Server with Apache Web Server on backend.
This article assume you are running Apache server on port 82, Using url like http://localhost:82/. Now we are going to put Apache traffic server on frontend of Apache web server on port 80, Using like url http://svr1.tecadmin.net. When we load http://svr1.tecadmin.net domain in bower the request will go to traffic server first and it will pass request to backend web server running on port 82.
Step 1: Install EPEL Repository
First we need to add EPEL rpm repository in our system. Use one of below commands as per your OS version and system architecture.
CentOS/RHEL 6, 32 Bit: # rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm CentOS/RHEL 6, 64 Bit: # rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm CentOS/RHEL 5, 32 Bit: # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm CentOS/RHEL 5, 64 Bit: # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-releas5-4.noarch.rpm
Step 2: Install Apache Traffic Server
After adding EPEL repository in system, install Apache traffic server using following command.
# yum install trafficserver
Step 3: Set Up Apache Traffic Server as Reverse Proxy
Firstly change your apache server to work with port 82.
Now we will configure Apache Traffic server to work on port 80 and setup reverse proxy setting. Apache Traffic Server uses two configuration files listed below as work.
- 1. /etc/trafficserver/records.config
- 2. /etc/trafficserver/remap.config
Edit records.config and change the port of Apache traffic server.
CONFIG proxy.config.http.server_port INT 80
Keep edit records.config file and update following line like below.
CONFIG proxy.config.proxy_name STRING svr1.tecadmin.net CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
Let’s edit remap.config file and add following line’s to map and reverse map.
map http://svr1.tecadmin.net:80/ http://localhost:82/ reverse_map http://localhost:82/ http://svr1.tecadmin.net/
Step 4: Restart Service
After making desired configuration, restart apache traffic server and configure to autostart on system boot.
# service trafficserver restart # chkconfig trafficserver on
Step 5: Analyze Header of Website
You have done all basic Apache Traffic server configuration. Lets check the header of website to make sure ATS is service data to users. Check below comparative response header result with ATS and without ATS.
With Apache Traffic Server
Without Apache Traffic Server
Congratulation’s! You have successfully install Apache Traffic Server and configure as front end proxy server for Apache. Click here to read complete guide for ATS administration.