Install and Configure Apache Traffic Server on Ubuntu Server 12.04


Apache Traffic server is a reverse proxy, cache proxy and forward proxy. Web proxy caching enables you to store copies of frequently accessed web objects and then serve this information to users on demand. It improves performance and frees up Internet bandwidth for other tasks.


Installation


Installation of Apache Traffic Server is bit tricky on Ubuntu due to absence of standard apt-get easy installer package. Well but its not that difficult though. I am writing down step by step process for easy understandability.

Download latest tar.bz2 from apache website and put that on Ubuntu server any directory.

wget http://www.apache.org/dyn/closer.cgi/trafficserver/trafficserver-4.0.1.tar.bz2

tar xf trafficserver-4.0.1.tar.bz2

cd trafficserver-4.0.1

 sudo apt-get install g++ libssl-dev tcl-dev libexpat1-dev libpcre3-dev libcap-dev libcap2

 ./configure

 $ make

 $ sudo make install

Server level configuration

 

After successful installation, open ld.so.conf (sudo vi /etc/ld.so.conf) and add following line.
include /usr/local/libexec/trafficserver

Run the following command: 
sudo ldconfig

Steps for Start and stop


To start Traffic Server manually, issue the following command, passing in the attribute start. This command starts all the processes that work together to process Traffic Server requests as well as manage, control, and monitor the health of the Traffic Server system.

sudo service trafficserver start/stop

All the configuration parameter related to cache are located in /usr/local/etc/trafficserver/records.config file after making any configuration changes do run command traffic_line -x to apply the configuration changes.

Installation Directories


When we install traffic server, we had not provide the installation directories for config files and executable. These stuffs has been placed with default conventions.

All configurations files :

/usr/local/etc/trafficserver/

All executables :

/usr/local/libexec/trafficserver

Important Configuration Files & Usage

 

sudo vi /usr/local/etc/trafficserver/records.config

For changing default port as well as connection time out etc. related data.
Don't forget to execute following command in case of minor rule change:

sudo traffic_line -x

In case of severe change like port etc please make sure you had restarted the server:

sudo service trafficserver restart

For Configuring the mapping 

 

sudo vi /usr/local/etc/trafficserver/remap.config

In the above file, we can provide as many map, reverse map, redirect, reverse redirect configurations.

Apache Virtual Host Specific Configuration

 

Step 1:
sudo vi /usr/local/etc/trafficserver/records.config

In the file make following changes so config read like below
CONFIG proxy.config.reverse_proxy.enabled INT 1
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1 (It make sure host name in http header doesn't change)
CONFIG proxy.configurl_remap.remap_required INT 1

Step 2:
sudo traffic_line -x

Step 3:
sudo vi /usr/local/etc/trafficserver/remap.config

Step 4:
sudo traffic_line -x
Above configuration is sufficient for setting the initial reverse proxy to listen on default port and serve the request based on domain name from provider (Apache)


Cache Configuration


CONFIG proxy.config.cache.ram_cache.size INT -1 (default value 1 MB per 1 GB Disk Space, alternatively you can set 20971520 (20 MB))

Monitoring Traffic & Log File


Log file location - var/log/trafficserver

We Would Like To Hear From You..