Here's the method I've been using.
- Install threaded Apache and apr and assort Apache dev libs.
- Create a deploy user and then install RVM in the deploy users homedir
- Now install either REE 1.8.7 or Ruby 1.9.2 via rvm. Both use less memory than standard 1.8.7 and you'll have to pick based on which one works best with your application.
- Now remove the Ubuntu mod_passenger packages and install Passenger as a gem through your deploy user using RVM with the ruby you want to use. Make sure you build the Passenger binaries using RVM as well. Make sure you're installing the correct Passenger for system as well which is either 2.x or 3.x
- Create /etc/apache2/mods-available/passenger2.conf or passenger3.conf as well as the matching passenger.load so they don't conflict with the passenger.conf the mod_passenger package uses. Make sure you copy the output from building Passenger correct as well as make sure you're specifying the RVM paths correctly for your version of Passenger which will very slightly depending on version 2.x or 3.x.
As thing point you should try to run your application and make sure it works. Once you have the site loading normally you can now start tweaking your Passenger config. The config I use looks like this.
# rvm and passenger paths
# set max instances
# Always have one instance running
# recyle an instance after 10k requests
# check tmp for restarts one request per 10 secs rather than every request
# don't shutdown any of the spawners
My config tries to keep an active instance at all times and uses a bit more memory by not shutting down the spawners. You want to use very little ram, but you don't want to to wait 15-30 seconds to serve a request because all the Rack process have been shutdown. I'd try something like the following in your case.
If things look pretty good you can start lowering settings and see how it works for you.