I just set up a virtual machine running Ubuntu Server, with a LAMP stack and OpenSSH installed.
What now would be the best way to enable that server to run both rails and PHP applications? Would it be best to virtualise the two servers on the host server machine? - Or can they run happily alongside each other?
Would Mongrel would be the best option for the rails server?
So, keeping your existing LAMP stack serving example1.com,, do the following to set up the Rails side on example2.com:
Run mongrel to listen on port 8000 (or whatever) (FWIW, we use Unicorn, which will handle the workers more elegantly).
On the Apache side, do something like this configuration:
You should peruse your Apache documents on "reverse proxy" and the "ProxyPassReverse" directive for specific details and gotchas.
So, your existing VirtualHost for example1.com will handle the LAMP stuff, and the VirtualHost for example2.com will proxy requests over to your Rails stack. Your Rails server will listen on port 8000, which is out of the way from LAMP.
They can run alongside each other perfectly happily.