我正在尝试运行一个相对简单的 rails 应用程序 (http:// www.enkiblog.com/),它还算可以工作。注释和管理界面只有在我使用“script/server -e production”并连接到端口 3000 时才有效(但仍处于生产模式)。
Nginx 的 error.log 中会有如下内容:
2009/06/02 21:46:10 [error] 11536#0: *18 upstream prematurely closed
connection while reading response header from upstream, client:
85.180.23.43, server: *.marc-seeger.de, request: "GET /admin HTTP/
1.1", upstream: "unix:/tmp/passenger.11520/master/
helper_server.sock:", host: "www.marc-seeger.de"
*** Exception NoMethodError in application (undefined method `each'
for nil:NilClass) (process 14080):
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/rack/request_handler.rb:
85:in `process_request'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_request_handler.rb:
203:in `main_loop'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/railz/
application_spawner.rb:340:in `start_request_handler'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/railz/
application_spawner.rb:298:in `handle_spawn_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/utils.rb:181:in `safe_fork'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/railz/
application_spawner.rb:296:in `handle_spawn_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in
`__send__'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in
`main_loop'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in
`start_synchronously'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:154:in
`start'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/railz/
application_spawner.rb:192:in `start'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:257:in
`spawn_rails_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/
abstract_server_collection.rb:126:in `lookup_or_add'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:251:in
`spawn_rails_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/
abstract_server_collection.rb:80:in `synchronize'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/
abstract_server_collection.rb:79:in `synchronize'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:250:in
`spawn_rails_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:153:in
`spawn_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:282:in
`handle_spawn_application'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in
`__send__'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in
`main_loop'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in
`start_synchronously'
from /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/
gems/passenger-2.2.2/bin/passenger-spawn-server:61
Error during failsafe response: closed stream
任何想法?
附言 Debian 5.0
答案1
当您没有在 SQLite 数据库上设置适当的权限时,您可能会从 nginx 收到类似的 502 错误。
答案2
原来是 Passenger + sqlite + nginx + unix 权限问题。
我通过迁移到 MySQL 解决了这个问题