Thursday, September 30, 2010

Running Apache Traffic Server on Fedora 13

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



[nareshv@fallenangel ~]$ 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



[nareshv@fallenangel ~]$ tar jxf trafficserver-2.0.1.tar.bz2
[nareshv@fallenangel ~]$ cd trafficserver-2.0.1
[nareshv@fallenangel trafficserver-2.0.1]$ ./configure
[nareshv@fallenangel trafficserver-2.0.1]$ gmake
[nareshv@fallenangel trafficserver-2.0.1]$ 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)



[nareshv@fallenangel ~]$ 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 <proxy_name>
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



[nareshv@fallenangel ~]$ ~]$ 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 ])
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL / was not found on this server.</p>
<hr>
<address>Apache/2.2.16 (Fedora) Server at localhost Port 8080</address>
</body></html>
* Connection #0 to host localhost left intact
* Closing connection #0

Saturday, September 25, 2010

64-bit Flash Plugin on Fedora-13 running Firefox 4

Firefox 4 is around the corner, those who are running Fedora-13 and want to try out the latest 64-bit flash plugin. These are the instructions

1. Go to our mozilla plugins directory


[nareshv@fallenangel plugins]$ cd ~/.mozilla/plugins
[nareshv@fallenangel plugins]$ pwd
/home/nareshv/.mozilla/plugins



2. Download the latest flash plugin from the following url http://labs.adobe.com/downloads/flashplayer10.html and follow these steps

Latest download link is here.

[nareshv@fallenangel plugins]$ wget 'http://download.macromedia.com/pub/labs/flashplayer10/flashplayer_square_p1_64bit_linux_091510.tar.gz'
--2010-09-25 19:16:17-- http://download.macromedia.com/pub/labs/flashplayer10/flashplayer_square_p1_64bit_linux_091510.tar.gz
Resolving download.macromedia.com... 69.192.35.191
Connecting to download.macromedia.com|69.192.35.191|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4308402 (4.1M) [application/x-gzip]
Saving to: “flashplayer_square_p1_64bit_linux_091510.tar.gz”

100%[========================================================================================================================================>] 4,308,402 506K/s in 13s

2010-09-25 19:16:31 (332 KB/s) - “flashplayer_square_p1_64bit_linux_091510.tar.gz” saved [4308402/4308402]

[nareshv@fallenangel plugins]$ tar zxf flashplayer_square_p1_64bit_linux_091510.tar.gz
[nareshv@fallenangel plugins]$ ls
flashplayer_square_p1_64bit_linux_091510.tar.gz libflashplayer.so libflashplayer.so.old
[nareshv@fallenangel plugins]$ ls -l libflashplayer.so
-rw-rw-r--. 1 envy envy 10601968 Sep 4 04:47 libflashplayer.so



3. open http://www.youtube.com and see the flash player in action



4. Have fun with the new flash player.