2
votes

I am using Ruby on Rails 3.1 and I have an application running at the www.mywebsitename.com domain. For improvement reasons I would like to run my application at the www.uk.mywebsitename.com subdomain (BTW: at the www.mywebsitename.com domain I will run a RoR application to redirect users to the proper subdomain).

I do not need geocoding or similar. Simply, I would like to know how to run my application on the www.uk.mywebsitename.com Web address (I am planning to add as subdomain other/similar RoR applications like www.de.mywebsitename.com and www.it.mywebsitename.com, each working with a separate database): what I have to care/do? what do you advice about?

P.S.: My server is running Linux Ubuntu and Apache. I deploy with the Capistrano gem.

1

1 Answers

4
votes

It seems like you're looking for how to make apache vhosts, since that's basically what they do.

I assume you're using phusion passenger, and in that case you should already have one vhost (or at least a default site in /etc/apache/sites-available (or something similar, it might be apache2, I'm not entirely sure).

What you basically need to do to get multiple rails applications working is to set up one vhost for each rails application and set the proper ServerName and DocumentRoot for each vhost.

It might look something like this for you uk site:

<VirtualHost *:80>
  ServerName www.uk.mywebsitename.com
  DocumentRoot /path/to/where/your/uk/site/is/deployed/current/public
  <Directory /path/to/where/your/uk/site/is/deployed/current/public>
    Allow from all
    Options -MultiViews
  </Directory>
</VirtualHost>

How to setup vhosts for passenger is documented in the passenger documentation.