Apache Traffic Server is a high-performance reverse proxy and forward proxy server licensed under Apache License. It allows you to improve the response time of your website while consuming less memory. It is used by many companies including Yahoo! and today we will show you how to install and configure it on a Linux Cloud VPS.
First thing to do after logging in to your server is to upgrade all your system software to the latest version.
sudo apt-get update sudo apt-get upgrade
After the upgrade is completed successfully you can continue with the instructions below to install Apache Traffic Server.
sudo apt-get install trafficserver
This should take a few moments. Once Apache Traffic Server is installed on your Ubuntu Cloud VPS you can go ahead and configure it to work as a reverse proxy with your Apache web server.
The very first file you need to edit is the ‘/etc/apache2/ports.conf’ file. Open the file using your favorite text editor and change the following line:
If port 82 is already used on your server by some other service you can use another port number which is available. Remember, you need to configure your Apache web server to listen locally. Next, you need to edit the virtual host for your website and change the following line:
Save the file and close it. Now restart your Apache web server for the changes to take effect.
sudo /etc/init.d/apache2 restart
To verify that Apache is listening on 127.0.0.1:82, you can execute the following command:
sudo netstat -tnlp
If everything is OK you can move on to the next step. Lets configure Apache Traffic Server to listen on port 80. For that purpose you need to edit the ‘/etc/trafficserver/records.config’ file. Change the following line:
CONFIG proxy.config.http.server_ports STRING 8080
CONFIG proxy.config.http.server_ports STRING 80
Then, edit the ‘/etc/trafficserver/records.config’ file and change the following line:
CONFIG proxy.config.proxy_name STRING allspice
CONFIG proxy.config.proxy_name STRING yourdomain.com
Do not forget to replace ‘yourdomain.com’ with your domain name. Also, make sure that the following line persists in the same file:
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
If not, you need to add it. Save the file and close it. Finally, edit the ‘/etc/trafficserver/remap.config’ file and add the following lines:
map http://yourdomain.com:80 http://127.0.0.1:82 reverse_map http://127.0.0.1:82 http://yourdomain.com:80
Again, do not forget to replace ‘yourdomain.com’ with your domain name.
Restart Apache Traffic Server using the following command:
Ensure that Apache Traffic Server is listening on port 80.
If everything is OK, you can test your website. Run the following command:
curl -I yourdomain.com
You should receive something like this:
... Server: ATS/5.3.0 ...
This means, Apache Traffic Server is listening in front of your Apache web server and the configuration has been successful.
Of course you don’t have to do any of this if you use one of our Linux Cloud VPS hosting services, in which case you can simply ask our expert Linux admins to install and configure Apache Traffic Server for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.