Skip to content
mengfung.com
writing

MediaTemple (dv) Passenger, Rack, Rails for multiple apps under the same domain

 ·  1 min read

Assuming you have all required gems and everything is working properly.

Technically you could have a Merb app running along side a Rails app, actually with Rack you could technically do whatever you wanted. Rails app with Merb or Rack middleware if you were so inclined.

My vhost.conf located in /var/www/vhosts/[domain]/conf looks like this:

#Passenger and Ruby-Enterprise
LoadModule passenger_module [path of .so]
PassengerRoot [path of were you installed passenger]
PassengerRuby [path to ruby could be enterprise-ruby or any install of ruby]
 
ServerName [servername]
ServerAlias [domain]
DocumentRoot /var/www/vhosts/[domain]/[root path of apps]
RailsBaseURI /testapp1
RailsBaseURI /testapp2
RackBaseURI /testrack1
<Directory "/var/www/vhosts/[domain]/[root path of apps]">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

I had to sym link the real directories of my apps like this:
[root@mengfung]# ln -s /var/www/vhosts/[domain]/railssrc/testrack1/public /var/www/vhost/[domain]/railsapps/testrack1

[root@mengfung]# ln -s /var/www/vhosts/[domain]/railssrc/testrails1/public /var/www/vhost/[domain]/railsapps/testrails1

[root@mengfung]# ln -s /var/www/vhosts/[domain]/railssrc/testrails2/public /var/www/vhost/[domain]/railsapps/testrails2

This also works well if you use Capistrano to deploy because you just sim link to the current dir of your project.

All three apps work under the same domain.