Tue, 23 Jun 09

Apacherb Is Now Hostess

A little while ago I wrote about a utility called apacherb. It took the concept of the passenger preference pane and applied it to any local directory (rather than specifically rails apps). I’d always meant to turn the utility into a gem but never quite got round to it. Luckily, James Adam moved the code to github, tidied it a little (notably making it restart apache after a change), renamed it and gemifimibulated it.

Install it with:

$ gem install hostess

Executing it without any arguments will display some simple instructions.

$ hostess
  Usage:
    hostess create domain directory - create a new virtual host
    hostess delete domain           - delete a virtual host
    hostess list                    - list hostess virtual hosts
    hostess help                    - this info

You’ll need to run it as sudo as it writes the configuration into /etc/apache2 and restarts apache.

To create a domain pointing at a local directory, you’d do something like:

$ sudo hostess create example.local ~/Sites/example.local/

This will register the local domain (the .local suffix is a convention rather than a rule) using directory services and add the apache virtual host. Open your browser and visit example.local to see your local site. Good huh.