An important point that was missed is how was he running the php and rails apps? mod_php? mod_rack? cgi? fastcgi? Proxying to an application server? The answer to that is going to greatly affect how well Apache scales when you're memory-constrained.
nginx: rails & sinatra are on passenger. php is php-fpm. nodejs is proxied