如何使用 Phusion Passenger 拥有一个用于开发的虚拟主机和另一个用于生产的虚拟主机?
基本上我想根据 URL 在生产或环境模式下访问相同的 Rails 应用程序。这可能吗?如何?
我尝试设置两个不同的虚拟主机,使用不同的 url 和 RailsEnv 值,但这不起作用:Apache 只会为任一 url 提供两个环境之一,更具体地说,是自 Apache 启动以来请求的第一个环境。
Basically I would like to access the same Rails app in production or environment mode depending on the URL. Is this possible? How?
I tried setting up two different virtual hosts, with different urls and values for RailsEnv, but that doesnt work: Apache will only serve one of the two environments for either urls, more specifically the first that was requested since Apache was started.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 10,000 英尺的高度来看,我猜测 Passenger 通过应用程序的完整文件系统路径在内部跟踪应用程序。所以对于 Passenger 来说,您的两个实例看起来是同一个。
您可以尝试将您的开发虚拟主机指向符号链接 - 这可能会欺骗 Passenger。如果没有,您不能只使用代码的两个不同的签出吗?那肯定会起作用。
At a 10,000ft view, I'm guessing Passenger keeps track of apps internally by their full filesystem paths. So to Passenger, your two instances look like the same one.
You might try pointing your development vhost at a symlink instead - that may trick Passenger. If not, couldn't you just use two different checkouts of your code? That would definitely work.