Locally Running Multiple Rails Apps on OS X

22 Sep 2005 in Macintosh, Programming, Ruby on Rails by Garrick

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.


Comment | Trackback URL Short Link:

Add a Comment


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Related Entries




Creative Commons License
About Sitemap XHTML Sitemap XML
Wordpress theme is a heavily hacked version of "Modicus Remix" by Art Culture. Original by Upstart Blogger