Jan 22, 2011

Apache 2.2 + Phusion Passenger

Apache 2.2 + Phusion Passenger is awesome. I have been using WEBrick for a while. It was friggin' slow. There are also other awesome alternatives: Thin, Mongrel, and nginx with unicorn.

Nginx + Unicorn is better at serving customer with high-speed internet connection. Actually, Unicorn is said to strictly serve local clients only, e.g., another program within the same computer. Therefore, Unicorn is good for a Rack-based application. You can read its well-written philosophy here. It also states why Nginx, not Apache, is the only webserver that is appropriate for Unicorn.

(There is an HTTP server, Rainbow, which strictly serves remote, low-speed client.)

So, Unicorn is not our appropriate solution.

Thin is said to be very faster. Nevertheless, this benchmark said that Passenger is the fastest web server among Thin and Mongrel.

(And some people have said that installing Mongrel is pains in the ass)

I haven't verified it myself, and I won't do it. I'm just gonna take it for grant :D

---------------------------------------------------

Ok, so this is how you install Apache with Passenger.

First, install Apache. This is pretty damn easy. If you cannot do it yourself, I suggest you should change your job.

Second, install passenger. (You need gem, just don't do it manually) type 'gem install passenger'.

Then, you type 'passenger-install-apache2-module'. If it does not detect your apache, then try to set the option '--apxs2-path'.

On the screen it will tell you to copy some text to Apache configuration file and how to point to the rails application. That's it !