如何在 Passenger suburi 部署上配置维护页面
我正在尝试为 Rails 应用程序的 Phusion Passenger 上的 suburi 部署获取维护页面设置。所有文档都显示了 DocumentRoot ReWrite 规则,这些规则不会出现(不认为它们应该)在 suburis 上重写。我尝试修改重写规则来指向 suburi,但我似乎无法让它工作。有谁能够获得有效的设置吗?
I am trying to get a maintenance page setup for a suburi deployment on Phusion Passenger for a rails app. All the documentation shows DocumentRoot ReWrite rules, which don't appear (don't think they should) rewrite on suburis. I tried hacking around on the ReWrite rules to point at the suburi, but I can't seem to get it to work. Has anyone been able to get a setup which works?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了完全相同的问题。
虽然我使用的是before过滤方式,但我其实很讨厌这种方法。
如果我有几个子uri,更新并回答
这将起作用,这里唯一缺少的是我无法将标头设置为503,因为ErrorDocument依赖于一个静态文件,我无法确定它在运行时的位置。
假设 app1 和 app2 是我的子 uri 之一
I am having exactly the same problem.
Although I am using the before filter way, I actually hate this method.
update and answer
this will work if I have several sub-uris, the only missing thing here is that I can not set the header to 503, because ErrorDocument is rely on a static file which I can not determine where it is in runtime.
assume app1 and app2 is one of my sub-uri
所以我终于有一些时间来研究这个问题,发现你实际上可以使用 mod_rewrite 方法来处理维护页面,并进行一些调整。请记住,对于子域,在根目录中创建了一个指向应用程序公共目录的符号链接。现在,如果公共目录包含维护文件(或在子目录中),您可以连接 mod_rewrite 来查找它。
例如,假设应用程序名为 app1,并且 maintenance.html 文件存储在 public 的子目录 system 中目录。以下是 apache 配置文件中的几行,它是在 RailsBaseURI /app1 行之前还是之后声明似乎并不重要
So I finally had some time to work on this and found that you can actually use the mod_rewrite method of handling maintenance page with some tweaks. Remember that for sub-domains there is a symbolic link created in the root directory to public directory of the application. Now if the public directory includes the maintenance file (or in a sub-directory) you can wire up mod_rewrite to find it.
For example assume application is named app1, and maintenance.html file is stored in a subdirectory system in the public directory. Here are the lines in the apache config file and it does not appear to matter whether it is declared before or after the RailsBaseURI /app1 line