Locally Running Multiple Rails Apps on OS X

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.

  1. Created 2 Rails apps; AppOne and AppTwo
  2. 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.)
  3. Opened up and unlocked NetInfoManager, duplicated machines > localhost twice, renamed one “appone” and the other “apptwo”.
  4. 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>

  5. Restarted Apache > sudo apachectl graceful
  6. Opened up two browers; one to http://appone/ and the other to http://apptwo/
  7. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *