简体   繁体   中英

How to run\handle multiple Ruby on Rails applications on the same domain?

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?

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM