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

发布于 2024-12-24 16:08:31 字数 542 浏览 2 评论 0原文

我正在使用 Ruby on Rails 3.1,并且有一个在 www.mywebsitename.com 域中运行的应用程序。出于改进原因,我想在 www.uk.mywebsitename.com 子域运行我的应用程序(顺便说一句:在 www.mywebsitename.com 域,我将运行 RoR应用程序将用户重定向到正确的子域)。

我不需要地理编码或类似的东西。简而言之,我想知道如何在 www.uk.mywebsitename.com 网址上运行我的应用程序(我计划添加其他/类似的 RoR 应用程序作为子域,例如 www.de .mywebsitename.comwww.it.mywebsitename.com每个都使用单独的数据库):我必须关心/做什么?您有什么建议?

PS:我的服务器运行的是 Linux Ubuntu 和 Apache。我使用 Capistrano gem 进行部署。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

靖瑶 2024-12-31 16:08:31

看起来您正在寻找如何制作 apache vhosts,因为这基本上就是他们所做的。

我假设您正在使用 phusion guest,在这种情况下,您应该已经有一个虚拟主机(或者至少在 /etc/apache/sites-available 中有一个默认站点(或类似的东西,可能是apache2,我不太确定)

要让多个 Rails 应用程序正常工作,您基本上需要做的是为每个 Rails 应用程序设置一个虚拟主机并设置正确的 ServerName。 > 和每个虚拟主机的 DocumentRoot

对于您的英国网站来说可能看起来像这样:

<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>

记录了如何为乘客设置虚拟主机 乘客文档

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文