Apache Traffic Server (ATS)

Apache Traffic server from Yahoo! Inc. is really powerful, extensible web server which is proved to serve 75K reqs/sec on commodity hardware.

In this post, you'll learn how to download and run the Traffic server on your desktop, notebook.


1. Download TrafficServer 2.0.1 (latest as of 30-Sep-2010)

http://trafficserver.apache.org/downloads.html

2. Install the following packages



$ sudo yum install autoconf automake  \
                              libtool gcc-c++ glibc-devel \
                              openssl-devel tcl-devel  \
                              expat-devel sqlite-devel  \
                              pcre-devel -y



3. Extract the trafficserver and build it



$ tar jxf trafficserver-2.0.1.tar.bz2
$ cd trafficserver-2.0.1
$ ./configure
$ gmake
$ sudo gmake install



Now, all the required files would be installed in "/usr/local" instead of Fedora's default /usr. Lets configure Traffic server to act as ReverseProxy for apache

5. set servername of your proxy (so that it will come up in the HTTP headers)



$ sudo vim /usr/local/etc/trafficserver/records.config

 # Change line 22 (it might vary) to put your hostname like shown below
 22 #CONFIG proxy.config.proxy_name STRING
 22 CONFIG proxy.config.proxy_name STRING fallenangel




6. Make the Traffic server listen on port 80 by default



[nareshv@fallenangel ~]$ sudo vim /usr/local/etc/trafficserver/records.config

# Change 8080 port to 80 like shown below
105 #CONFIG proxy.config.http.server_port INT 8080
105 CONFIG proxy.config.http.server_port INT 80



7. Make Traffic server act as reverse proxy for apache

You can add as many rules as you want. The configuration file is well defined


[nareshv@fallenangel ~]$ sudo vim /usr/local/etc/trafficserver/remap.config

124
125 map http://localhost:80/ http://localhost:8080/
126 map http://fallenangel:80/ http://localhost:8080/



8. configure apache to listen on port 8080



[nareshv@fallenangel ~]$ sudo vim /etc/httpd/conf/httpd.conf
# Change it from default port 80 to 8080
#Listen 80
Listen 8080



9. Restart apache



[nareshv@fallenangel ~]$ sudo /etc/init.d/httpd restart



10. Restart traffic server



[nareshv@fallenangel ~]$  sudo /usr/local/bin/trafficserver restart
Stopping traffic_cop:                                      [  OK  ]
Stopping traffic_manager:                                  [  OK  ]
Stopping traffic_server:                                   [  OK  ]
Starting Apache Traffic Server:                            [  OK  ]



11. Make simple request to your TrafficServer to test if everything is ok



$ curl -v http://localhost/
* About to connect() to localhost port 80 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.20.1 (x86_64-redhat-linux-gnu) libcurl/7.20.1 NSS/3.12.6.2 zlib/1.2.3 libidn/1.16 libssh2/1.2.4
> Host: localhost
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Thu, 30 Sep 2010 09:47:53 GMT
< Server: ATS/2.0.1
< Content-Type: text/html; charset=iso-8859-1
< Age: 0
< Transfer-Encoding: chunked
< Connection: keep-alive
< Via: HTTP/1.1 fallenangel (ApacheTrafficServer/2.0.1 [cMs f ])
<





Not Found



The requested URL / was not found on this server.





Apache/2.2.16 (Fedora) Server at localhost Port 8080


* Connection #0 to host localhost left intact
* Closing connection #0

1 comment:

Maicolgmid said...

quisiera saber si me podrias ayudar con este error que me sale al complital traffic.

configure: error: in `/home/maicol/Desktop/trafficserver-2.0.0':
configure: error: check for sqlite3 failed. Have you installed sqlite3-devel?
See `config.log' for more details.