I got a new 1GB slicehost [1] 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 [2]
- Install all the required software [3]
- Setup and configure the rails deployment [4]