【问题标题】:500 Internal Server Error with Rails ProductionRails 生产出现 500 内部服务器错误
【发布时间】:2013-09-04 20:32:37
【问题描述】:

我最近将一些新文件上传到我的生产服务器(并覆盖了旧文件),现在收到 500 内部服务器错误。服务器正在运行 phusion 乘客(即使我不再收到该错误消息)并且在我的本地测试环境中一切似乎都工作正常。

这里是网站:http://www.pandonews.com/

当我查看我的 apache 日志时,我看到了这个错误:

[ pid=3106 thr=140057117177664 file=ext/apache2/Hooks.cpp:884 time=2013-09-01 17:37:24.84 ]: Unexpected error in mod_passenger: Cannot spawn application '/var/www/feedme': The spawn server died unexpectedly, and restarting it failed.
  Backtrace:
     in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:742)
     in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:312)
     in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:585)

我不知道问题是什么。到目前为止,它一直运行良好。我真的不知道从哪里开始来解决这个问题。我尝试再次运行 gem 乘客安装,但没有任何反应。

近期活动:

  • 已安装 pg gem(但在决定暂时使用 sqlite3 后将其从 gem 文件中删除)yml 文件应该没问题...
  • 尝试在服务器和本地运行包更新,但一直挂起
  • 更改了一些 javascript 和 css 文件...
  • 尝试使用 RAILS_ENV=production rake:db reset 重置服务器 - 没有变化!

编辑: 运行 rails s 生产时出现以下错误:

/home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- rack/handler/production (LoadError)
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `block in require'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:251:in `require'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/handler.rb:63:in `try_require'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/handler.rb:16:in `get'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/server.rb:272:in `server'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands/server.rb:59:in `start'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
from /home/otto/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.7/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

EDIT2:

$ passenger-status
ERROR: Phusion Passenger doesn't seem to be running.

EDIT3: 好像它正在运行,仍然是内部服务器错误:

passenger start -a 0.0.0.0 -p 3000 -d -e production
=============== Phusion Passenger Standalone web server started =============== 
PID file: /var/www/feedme/tmp/pids/passenger.3000.pid
Log file: /var/www/feedme/log/passenger.3000.log
Environment: production
Accessible via: http://0.0.0.0:3000/

Serving in the background as a daemon.
===============================================================================
otto@scraper:/var/www/feedme$ passenger status
Phusion Passenger Standalone is running on PID 18788, according to PID file /var/www/feedme/tmp/pids/passenger.3000.pid
otto@scraper:/var/www/feedme$ 

【问题讨论】:

  • 您的生产日志上会显示什么?如果您尝试手动启动应用程序,例如 rails s production,使用通常运行 rails 进程的用户登录会发生什么?
  • 3.2.7 上的所有 Rails 宝石吗?好像是版本不兼容。

标签: ruby-on-rails ruby apache passenger production-environment


【解决方案1】:

做了以下事情:

  1. gem 安装乘客(没有 sudo 或任何东西)
  2. 查找根目录:passenger-config –root
  3. 从 root 到用户名文件夹将 chmod 分配给所有文件夹:sudo chmod -R 777 /home/username/.rvm/gems/ruby-1.9.3-p392/gems/passenger-4.0.14 到 /home/ 之前的每个文件夹用户名/
  4. passenger-install-apache2-module(没有任何东西)
  5. 把你给的代码粘贴进去:/etc/apache2/httpd.conf
  6. sudo service apache2 重启

【讨论】:

  • 当前 -root 无法使用它的乘客配置 --root
  • 使用“passenger-config validate-install”它应该会指导您修复您的乘客设置。
猜你喜欢
  • 1970-01-01
  • 2013-03-13
  • 2019-11-29
  • 2015-02-07
  • 1970-01-01
  • 2021-06-09
  • 2011-05-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多