简体   繁体   English

如何在同一域上运行\\处理多个Ruby on Rails应用程序?

[英]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.comwww.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应用程序设置一个虚拟主机,并为每个虚拟主机设置适当的ServerNameDocumentRoot

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.

相关问题 在 nginx 上运行多个 Ruby on Rails 应用程序 - Run multiple Ruby on Rails applications on nginx 如何在同一个Ruby on Rails应用程序中基于不同的域名显示不同的内容? - How can I show different content based on different domain name in same Ruby on Rails applications? Ruby on Rails的多个应用程序 - Multiple applications with Ruby on Rails 如何在Heroku上的Rails应用程序上使用多个ruby - How to work with multiple ruby on rails applications on heroku 扩展:如何处理Ruby on Rails应用程序之间的通信? - Scaling Out: how to handle communication between Ruby on Rails applications? 无论如何,是否可以在Windows机器上运行Ruby on Rails应用程序? - Is there anyway to run Ruby on Rails applications on a Windows box? 如何在 ruby​​ on rails 中处理具有相同值名称的 JSON - How to handle a JSON with same value names in ruby on rails Ruby on Rails-如何通过一笔付款处理资金并创建多个预订 - Ruby on Rails - how to handle money and create multiple bookings with one payment Ruby on Rails-如何在创建时处理belongs_to - Ruby on Rails - how to handle belongs_to multiple on create 如何在Ruby on Rails事务中处理多个异常以导入文本文件 - How to handle multiple exceptions in a Transaction with Ruby on Rails for importing a text file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM