使用Rails生成500内部服务器错误

时间:2013-09-01 17:58:05

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

我最近将一些新文件上传到我的生产服务器(并覆盖旧文件),现在得到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 - no change!

修改 当运行rails的生产时,我收到以下错误:

/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$ 

1 个答案:

答案 0 :(得分:2)

做了以下事情:

  1. 宝石安装乘客(没有sudo或任何东西)
  2. 查找root: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 restart
相关问题