There’s a couple of place describing how to support multiple Rails apps locally. They were either unavailable or way more complicated than I’d like (the HowtoDeployMoreThanOneRailsAppOnOneMachine at the RubyonRails wiki was both). Here’s how I was able to get multiple Rails apps running under Apache on OS X 10.4 Tiger.
- Created 2 Rails apps; AppOne and AppTwo
- In each of the apps’
public/index.html
file I changed “Welcome to Ruby on Rails” to “Welcome to AppOne” and “Welcome to AppTwo” respectively. (You don’t need to do this, though it did seem to be the easiest way to see when it works.) - Opened up and unlocked NetInfoManager, duplicated
machines > localhost
twice, renamed one “appone” and the other “apptwo”. - Opened up Apache’s httpd/httpd.conf file, uncommented NameVirtualHost *:80 and added the VirtualHost blocks.
NameVirtualHost *:80<virtualhost *>
ServerName AppOne
DocumentRoot /Users/garrickvanburen/Rails/AppOne/public/
<directory /Users/garrickvanburen/Rails/AppOne/public/>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</virtualhost>
<virtualhost *>
ServerName AppTwo
DocumentRoot /Users/garrickvanburen/Rails/AppTwo/public/
<directory /Users/garrickvanburen/Rails/AppTwo/public/>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</virtualhost>
- Restarted Apache
> sudo apachectl graceful
- Opened up two browers; one to
http://appone/
and the other tohttp://apptwo/
- Clapped and victoriously declared “Yea” to an empty room.
As I should have known, this blew up my non-Rails localhosting – specifically phpMyAdmin. Repeating the steps above for phpmyadmin returned access to my database.