ruby-on-rails – Rails应用程序和Mongrel的奇怪问题

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails应用程序和Mongrel的奇怪问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近在serverfault.com上发布了一个与此问题有关的问题: https://serverfault.com/questions/152587/apache-mod-proxy-to-another-server

我已经意识到这不是我的服务器设置的问题,而是我的rails应用程序.我已经将这个应用程序与服务器上的功能完全相同,就像我在同一个服务器上运行的另一个功能很大的rails应用程序一当我启动服务器我的mongrel.log看起来像这样:

** Daemonized,any open files are closed.  Look at /var/www/osuwebdev/tmp/pids/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:8080
** Starting Rails with production environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:8080
** Writing PID file to /var/www/osuwebdev/tmp/pids/mongrel.pid

当我加载页面时,会弹出日志:

Wed Jun 30 19:46:10 +0000 2010: Error calling Dispatcher.dispatch #<NoMethodError: undefined method `[]' for nil:NilClass>
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:135:in `out'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81:in `process'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:282:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/local/bin/mongrel_rails:19:in `load'
/usr/local/bin/mongrel_rails:19

我不知道这个应用程序有什么不同可能导致这个问题.

@H_502_12@

解决方法

我相信这是Rack,Mongrel和Rails中的一个奇怪的错误组合.

>将你的应用程序中的这个ruby代码保存到config / mongrel.rb:http://gist.github.com/471663
>在你的config / environment.rb文件末尾添加
需要File.join(File.dirname(File.expand_path(FILE)),’mongrel’)
>在同一个文件中,将这行添加到Rails :: initializer.run块中:
config.gem“mongrel”

更长的解释这里的问题:https://rails.lighthouseapp.com/projects/8994/tickets/4690-mongrel-doesnt-work-with-rails-238

这对于Rails 2.3.8应用程序来说肯定是有效的,尽管我的修补与上述略有不同.

@H_502_12@ @H_502_12@

猜你在找的Ruby相关文章