Setting up a webserver for Rails
Rails runs on most operating systems like Linux, Mac, BSD and Windows. You also have to choose from a wide range of webserver configurations. The most
popular ones are listed below, with links to sites where you can find configuration details. Which configuration is the best, is mostly a matter
of personal taste. Choose the one you have the most experience with.
If it works, you are good to go.
Some things you should never do.
- You should never choose cgi, which is too slow if you run a Rails
application on it.
- Never do a deployment with Webbrick, the Ruby webserver included with every
Ruby installation. Webbrick is fine for development, but too slow for production.
- Never deploy your Rails application solely with Mongrel. Mongrel is designed
to serve up Ruby code (Rails, Nitro, Camping, ...), but it isn't suitable to
serve static content like images, html, css or javascript. Mongrel should always
be deployed behind another webserver, like Apache.
Apache + fastcgi
Apache: http://httpd.apache.org/
Apache + fastcgi setup:
Tuning Apache + fastcgi: http://scottstuff.net/blog/articles/2005/07/20/apache-tuning-for-rails-and-fastcgi
Interesting story about FastCGI, SCGI, and Apache: http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/
Apache + fcgid
Apache: http://httpd.apache.org/
fcgid: http://fastcgi.coremail.cn/
Apache + fcgid setup:
Apache + Mongrel
Apache: http://httpd.apache.org/
Mongrel: http://mongrel.rubyforge.org/
Apache + Mongrel:
Litespeed
This sites runs on Litespeed. So it's the only webserver I can comment on. I initially wanted to run on Apache + Mongrel, but my configuration
resultated in a high memory usage. And when I hammered it with ab, the CPU usage went through the roof. That is why I went for Litespeed. The
advantages of Litespeed are GUI to setup and manage it, easy to update (it checks daily for new releases) and downgrade, uses very few resources,
really fast and great support. Disadvantages are the fact that you have many options to fine tune it, too many. And it isn't always clear what all
the options do. You sometimes need to upgrade ruby-lsapi, with gem update ruby-lsapi. Other than that I'm quite happy with it. Please use
Litespeed as a standalone webserver, don't proxy it behind Apache or put Mongrels behind it. Litespeed is good enough to do all the work for you.
Litespeed webserver: http://www.litespeedtech.com
Litespeed up and running in under 4 minutes: http://i.nfectio.us/articles/2006/09/04/litespeed-web-server-2-2-includes-rails-support
Nginx + Mongrel
Nginx: http://sysoev.ru/en/
Mongrel: http://mongrel.rubyforge.org/
Nginx + Mongrel setup:
Lighttpd
Lighttpd: http://www.lighttpd.net/
Lighttpd setup:
Lighttpd + Mongrel
Don't use this solution until Lighttpd 1.5 comes out. Their have been many reports of problems with the mod_proxy plugin. They will however be fixed in
verion 1.5. But you can also use Lighttpd without Mongrel to serve up your Rails pages.
Lighttpd: http://www.lighttpd.net/
Mongrel: http://mongrel.rubyforge.org/
Lighttpd + Mongrel setup: http://mongrel.rubyforge.org/docs/lighttpd.html
Pound + Mongrel
Pound: http://www.apsis.ch/pound/
Mongrel: http://mongrel.rubyforge.org/
Pound + Mongrel setup:
Pen + Mongrel
Pen: http://siag.nu/pen/
Mongrel: http://mongrel.rubyforge.org/
Pen + Mongrel setup:
Balance + Mongrel
Balance: http://www.inlab.de/balance.html
Mongrel: http://mongrel.rubyforge.org/
Balance + Mongrel setup: http://mongrel.rubyforge.org/docs/pen_balance.html
IIS
Rails on IIS:
Zeus
Zeus: http://www.zeus.com/
|