【问题标题】:Problems running Ruby on Rails apps on shared hosted server在共享托管服务器上运行 Ruby on Rails 应用程序的问题
【发布时间】:2011-02-24 02:34:13
【问题描述】:

我在共享托管服务器上安装 任何 Ruby On Rails 应用程序时遇到问题。 Mongrel 将 html 显示为所有页面的纯文本。任何应用都会出现此问题,即使我创建了一个测试空应用并添加了一个脚手架视图而不进行任何更改。

在尝试将 cookie 放入响应标头时,Mongrel 似乎崩溃了。 HTTP 标头看起来不完整,缺少 Content-type 和其他参数:

curl 127.0.0.1:12002/users -I
HTTP/1.1 200 OK
Connection: close
Date: Wed, 26 May 2010 09:46:50 GMT
Content-Length: 0

这是 mongrel.log 的输出

Error calling Dispatcher.dispatch #<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]>
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'

红宝石 1.8.7 导轨 2.3.8 杂种 1.1.5

这里是link to the test page。

有人见过这样的吗?

【问题讨论】:

    标签: ruby-on-rails ruby mongrel


    【解决方案1】:

    此解决方法修复了我的问题: https://rails.lighthouseapp.com/projects/8994/tickets/4690#ticket-4690-23

    基本上就是在config/initializers下添加这个mongrel.rb

    http://gist.github.com/471663

    【讨论】:

      【解决方案2】:

      就我而言,这个确切的问题是在使用“mongrel_rails”命令运行 mongrel 时发生的。使用“脚本/服务器”命令(如果存在,它也会启动 mongrel)解决了这个问题。

      也许您可以写信给您的虚拟主机提供商以检查这一点。

      【讨论】:

        【解决方案3】:

        我在这里发布了一个解决方案:

        https://rails.lighthouseapp.com/projects/8994/tickets/4690

        让我知道它是否适合您。

        谢谢, 迈克 C

        【讨论】:

        • 感谢您的回答。不幸的是,我没有资格对框架的源代码进行修复。现在我刚刚回滚到 2.3.5,将等待版本 3。
        猜你喜欢
        • 1970-01-01
        • 2016-04-17
        • 2016-11-20
        • 2017-01-25
        • 2011-04-23
        • 1970-01-01
        • 2014-07-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多