在共享托管服务器上运行Ruby on Rails应用程序时出现问题 [英] Problems running Ruby on Rails apps on shared hosted server

查看:122
本文介绍了在共享托管服务器上运行Ruby on Rails应用程序时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have problems installing any Ruby On Rails app on my shared hosted server. Mongrel shows html as plain text for all pages. The problem occurs for any app, even if I create a test empty app and add a scaffolded view without changing anything.

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

It appears that the Mongrel crashes when trying to put cookies to the response header. The HTTP header looks incomplete, the Content-type and other parameters are missing:

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的输出

Here is the output from 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

ruby 1.8.7 rails 2.3.8 mongrel 1.1.5

这是链接到测试页面的链接.

有人看见过这样的东西吗?

Has anyone seen anything like this?

推荐答案

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

This workaround fixed mine: https://rails.lighthouseapp.com/projects/8994/tickets/4690#ticket-4690-23

基本上是在config/initializers下添加此mongrel.rb

It is basically adding this mongrel.rb under config/initializers

http://gist.github.com/471663

这篇关于在共享托管服务器上运行Ruby on Rails应用程序时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆