One of the first steps when I start a new project is to define a virtual host for the project because I prefer urls in the format http://myproject.localhost over http://localhost/myproject on my local development machine.
As I currently use Apache2 for both, Rails (using mod_rails) and CakePHP, a virtual host entry in /etc/apache2/sites-available/default looks like:
<VirtualHost *:80>
ServerName myproject.localhost
DocumentRoot /<path_to_document_root_of_myproject>
</VirtualHost>
If you have a CakePHP project, the path to the DocumentRoot is usually something like:
DocumentRoot /<path_to_the_projects>/myproject/app/webroot
With Rails, on the other hand, the path to the DocumentRoot is something like:
DocumentRoot /<path_to_the_projects>/myproject/public
After a restart of Apache you should get the welcome screen of the respective framework if you go to http://myproject.localhost (assuming you already “baked” the project structure and added an entry to the /etc/hosts file).

You also need to make an entry to your hosts file (sitting in /etc/hosts on mac and most Linuxes, and somewhere deep in the Windows directories…).
I do the same!
My c:\windows\system32\drivers\etc\hosts is huuuge! :D
@Dirk, Jaime: Thanks for your comments!
@Jaime: The same here ;-)
Hi,
I just installed mod_rails(passenger) at work, and
tried building multiple rails apps in Sub directories(Sub URIs). To do this,
make a symbolic link on the document root that points
to your rails’ public directory.
Then,
include “RailsBaseURI /”
in VirtualHost.
oops!
that should be “
RailsBaseURI /< app-name >“@jojo: Thanks for this tip, maybe this will become handy in the future!
mod_rails defaults to production mode, so don’t forget to set
RailsEnv "development"in your vhost.
@Nate: Thanks for this hint! It was one of the first issues I encountered in Railsland ;-)