如何在一个域上部署多个 Rails 应用程序而无需符号链接
根据乘客文档,可以通过设置中央 Rails 应用程序在一个域上部署多个 Rails 应用程序,然后通过在此应用程序的公共目录中创建符号链接来链接其他应用程序(并告知网络服务器)。
这实际上是相当混乱的。有没有办法仅通过网络服务器配置来实现此行为?我正在使用 apache2 和 mod_rails。
我想要的是以下内容:
myapp.subdomain.domain.tld myapp.subdomain.domain.tld/staging myapp.subdomain.domain.tld/development
其中每个 URL 都指向不同的 Rails 项目,该项目驻留在服务器上的以下目录中:
/var/www/myapp/products/current/public /var/www/myapp/staging/current/public /var/www/myapp/development/current/public
在这种情况下,我需要将符号链接放在生产文件夹的公共文件夹中,这不是我想要的(感觉很脏)。这些项目甚至可能稍后将驻留在不同的服务器上。
According to the passenger documentation it is possible to deploy multiple rails apps on one domain by setting a central rails app and then link in other apps by creating symbolic links in the public directory of this app (and tell the webserver about it).
This is actually pretty messy. Is there a way to achieve this behaviour just with the webserver configuration? I am using apache2 with mod_rails.
What i want is the following:
myapp.subdomain.domain.tld
myapp.subdomain.domain.tld/staging
myapp.subdomain.domain.tld/development
Where each of the URLs point to a different rails project which reside in the following directories on the server:
/var/www/myapp/production/current/public
/var/www/myapp/staging/current/public
/var/www/myapp/development/current/public
In this scenario i would need to place the symbolic links in the public folder of the production folder, which is not what i want (it feels very dirty). It might even be that these projects will later reside on different servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所需要的只是启用 mod_alias 并使用 alias 指令来映射不同的位置
myapp.subdomain.domain.tld 默认情况下将映射到文档根目录中定义的位置
然后
对于 myapp.subdomain.domain.tld/staging
指令
使用myapp.subdomain.domain.tld/development
使用指令
有关更多信息,请查看以下 mod_alias 文档: http://httpd .apache.org/docs/2.0/urlmapping.html
All you need is to enable mod_alias and use alias directive to map different locations
myapp.subdomain.domain.tld will map by default to the location as defined in the document root
then
for myapp.subdomain.domain.tld/staging
use the directive
for myapp.subdomain.domain.tld/development
use the directive
For further informations, take a look at the following mod_alias doc : http://httpd.apache.org/docs/2.0/urlmapping.html