I got a new 1GB slicehost vps yesterday. Up to now my preferred rails deployment was to use pound to proxy dynamic requests to a cluster of mongrels and static requests to lighttpd. Previously I had used lighttpd with fast-cgi but since mongrel was released I have avoided fast-cgi solutions. I also played around with using nginx with mongrel. For my new vps I decided to move from my previous deployment configuration of pound, lighttpd and mongrel to apache 2.2 with mod_proxy_balance and mongrel.
Reasons for changing deployment strategies
- Complexity: Remove one component from the deployment loop. 3 components becomes 2 and removes one potential point of failure and reduce complexity of configuration.
- Memory: Previously I was optimizing for a small memory footprint. Both nginx and lighttpd use less memory than apache. But a 1GB vps has plenty of memory to run apache.
- Virtual hosts: I want to deploy several websites from one vps - apache vhosts are the nicest way to do this. This is a cleaner solution that using pound to redirect requests based on the incoming url. I couldn’t find much info on nginx support for vhosts
- PHP: I want to serve both rails and php apps with this setup.
- Rewrite rules: mod_rewrite is a lot more powerful than the rewrite engines in nginx and lighttptd
Steps to get the server setup
The following three articles cover most of the steps I took to get setup
- Secure the Ubuntu server
- Install all the required software
- Setup and configure the rails deployment
Bookmark/Search this post with:
Aidan,
I am quite likely to use a similar setup in the future (one of my projects involves the Rails and PHP combo). Thanks for sharing this, I will make great use of it!
I've been using mongrel behind nginx recently serving many virtual hosts, I really like nginx, it's very fast and lightweight. Give me a shout for config details.
Nginx has quickly become my favorite HTTP server, especially for pure Rails hosting. On a major site I run (6-10 Mbit traffic spikes, 10-15 req/sec), Nginx is the HTTP frontend. Even with SSL, Nginx rarely takes up more than 2MB of system memory. CPU utilization is also incredibly low.
For vhost configuration, check out the Nginx English-language wiki. Specifically, see http://wiki.codemongers.com/NginxVirtualHostExample. Not too different from Lighttpd syntax, actually.
I strongly suggest nginx for any VPS setup
Just wanted to echo the above comments regarding nginx. I've previously used pound/lighttpd/mongrel (actually, based in part on one of your earlier articles), but after a recent switch to nginx on slicehost I don't think I'll be going back.
Actually this post is quite old and I’m now using nginx for deploying some of my rails apps. See http://www.aidanf.net/blog/deploying-rails-applications-using-nginx for details.
Post new comment