This task is done by configure correctly the virtualhost of your server (not RoR or Passenger).
You should localize the host file on your webserver (apache, nginx,..) and put something like this:
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName example.com
# Other directives here
</VirtualHost>
Maybe this link can help you: http://httpd.apache.org/docs/trunk/vhosts/examples.html