在 RoR 中配置多个应用程序
我想要多个可以相互通信的 RoR 应用程序(数据库、方法调用……)。
我想要的示例:
- 在 URL http:// www.< 上运行的主应用程序application_name > .com
- 在 URL http:// www 上运行的子应用程序 1。 application1_name >.< application_name > .com
- 在 URL http:// www 上运行的子应用程序 2。 application2_name >.< application_name >.com
每个都有自己的数据库。
我如何配置我的应用程序?在哪里可以找到满足我需求的教程?
I would like to have multiple RoR applications that can communicate with each other (databases, method calls, ...).
Example of what I would like:
- a main application running on a URL http:// www.< application_name >.com
- a sub-application 1 running on a URL http:// www.< application1_name >.< application_name >.com
- a sub-application 2 running on a URL http:// www.< application2_name >.< application_name >.com
each with own databases.
How can I configure my applications? Where can I find a tutorial for my needs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没问题。在您的情况下,您将拥有 3 个不同的 Rails 应用程序。您将设置 Web 服务器以根据访问三个应用程序之一的主机发送请求。这是标准的 Web 服务器配置。您需要阅读 Apache 或 Nginx 配置,了解如何将请求路由到正确的 Rails 应用程序。
编辑:
http://articles.slicehost.com /2009/3/11/ubuntu-intrepid-nginx-rails-and-mongrels
不确定您将使用什么作为您的 Web 服务器(Apache 或 Nginx 或其他)或您将使用什么作为您的应用程序容器(mongrel/passenger/thin 等),但上面的这篇文章应该有所帮助。
No Problem. In your case you will have 3 distinct Rails applications. You will setup your Webserver to send requests based on host accessed to one of the three applications. This is standard web server configuration. You'll need to read Apache or Nginx configuration on how to route request to the right rails application.
EDIT:
http://articles.slicehost.com/2009/3/11/ubuntu-intrepid-nginx-rails-and-mongrels
Not sure what you are going to use as your Web Server (Apache or Nginx or something else) or what you are going use as your application container (mongrel/passenger/thin etc) but this article above should help.
您可以查看 eco_apps gem - https://github.com/idapted/eco_apps。我听说开发人员在 Rails Conf '10 上对此进行了演讲。令人着迷的东西,虽然我还没有机会使用它。
You might take a look at the eco_apps gem - https://github.com/idapted/eco_apps. I heard the developers give a talk about it at Rails Conf '10. Fascinating stuff, though I haven't had a chance to use it yet.