[英]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. 我正在使用Ruby on Rails 3.1,并且在www.mywebsitename.com
域中运行了一个应用程序。 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). 出于改进原因,我想在www.uk.mywebsitename.com
子域中运行我的应用程序(顺便说一句:在www.mywebsitename.com
域中,我将运行RoR应用程序将用户重定向到正确的子域)。
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? 简而言之,我想知道如何在www.uk.mywebsitename.com
网址上运行我的应用程序(我打算将其他/类似的RoR应用程序(如www.de.mywebsitename.com
和www.it.mywebsitename.com
添加为子域。 www.it.mywebsitename.com
, 每个都使用单独的数据库 ): 我要关心/做什么? what do you advice about? 您有什么建议?
PS : My server is running Linux Ubuntu and Apache. PS :我的服务器正在运行Linux Ubuntu和Apache。 I deploy with the Capistrano gem. 我使用Capistrano gem进行部署。
It seems like you're looking for how to make apache vhosts, since that's basically what they do. 似乎您正在寻找如何制作apache虚拟主机,因为这基本上就是它们的工作。
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). 我假设您使用的是phusion passenger,在这种情况下,您应该已经拥有一个虚拟主机(或/etc/apache/sites-available
中至少有一个默认站点(或类似的东西,可能是apache2
,我并不完全当然)。
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. 要使多个Rails应用程序正常工作,基本要做的是为每个Rails应用程序设置一个虚拟主机,并为每个虚拟主机设置适当的ServerName
和DocumentRoot
。
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 . 乘客文档中记录了如何为乘客设置虚拟主机。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.