使用http://www.modrails.com/install.html上的指南,我在rails和phusion-passenger上安装了Ruby,以便使用apache2进行部署。 (在ubuntu-server上)(这不是开发服务器)。当我运行“rails -s”时,rails脚本工作正常,但是当我尝试使用apache访问服务器时,我得到“500 - 内部服务器错误”。
来自apache的错误文件:
[Fri Apr 27 22:52:01 2012] [notice] caught SIGTERM, shutting down
[Fri Apr 27 22:52:02 2012] [warn] module passenger_module is already loaded, skipping
[Fri Apr 27 22:52:02 2012] [notice] Apache/2.2.20 (Ubuntu) Phusion_Passenger/2.2.11 PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch configured -- resuming normal operations
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- phusion_passenger/utils (LoadError)
[Fri Apr 27 22:52:02 2012] [notice] Apache/2.2.20 (Ubuntu) Phusion_Passenger/2.2.11 PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch configured -- resuming normal operations
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- phusion_passenger/utils (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/phusion_passenger/passenger-spawn-server:53:in `<main>'
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- phusion_passenger/utils (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/phusion_passenger/passenger-spawn-server:53:in `<main>'
[ pid=1140 file=ext/apache2/Hooks.cpp:727 time=2012-04-27 22:52:08.639 ]:
Unexpected error in mod_passenger: Cannot spawn application '/var/www/steffen/rails': The spawn server has exited unexpectedly.
Backtrace:
in 'virtual Passenger::Application::SessionPtr Passenger::ApplicationPoolServer::Client::get(const Passenger::PoolOptions&)' (ApplicationPoolServer.h:471)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:523)
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- phusion_passenger/utils (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/phusion_passenger/passenger-spawn-server:53:in `<main>'
[ pid=1139 file=ext/apache2/Hooks.cpp:727 time=2012-04-27 22:52:10.809 ]:
Unexpected error in mod_passenger: Cannot spawn application '/var/www/steffen/rails': The spawn server has exited unexpectedly.
Backtrace:
in 'virtual Passenger::Application::SessionPtr Passenger::ApplicationPoolServer::Client::get(const Passenger::PoolOptions&)' (ApplicationPoolServer.h:471)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:523)
任何熟悉此错误的人 - 感觉就像帮助我们一样?
据我所知,这个错误是解决问题的关键,但是googeling并没有帮助我。
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- phusion_passenger/utils (LoadError)
编辑: 我发现我的第一个错误是我在apache中的mods-enable文件中写了“bun”而不是“bin”。因此,不要将其指向正确的ruby目录。
我现在得到乘客产生的错误。说以下内容:
Ruby (Rack) application could not be started
Error message:
no such file to load -- bundler
然后它继续进行长时间的回溯,我会在这里发布一个简短的snippitt:
Backtrace:
0 lib/rubygems/custom_require> 29:in `require'
1 lib/rubygems/custom_require> 29:in `require'
2 /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb 325 in `prepare_app_process'
3 /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 156 in `block in initialize_server'
4 /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
5 /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb 154 in `initialize_server'
6 /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
答案 0 :(得分:1)
我遇到了同样的问题,然后通过宝石安装乘客修复了它。
访问Phusion Passenger(mod_rails)网站,获取有关Passenger的完整文档。 您需要安装GCC来安装乘客。
通过Gem安装Passenger
gem install passenger
运行apache2的乘客安装脚本
passenger-install-apache2-module
将以下内容放在/etc/httpd/conf.d/passenger.conf中(最好直接从passenger-install-apache2-module输出中复制)
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.3/ext/apache2 /mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.3
PassengerRuby /usr/bin/ruby
原始指南位于http://www.interworx.com/support/faq/how-to-install-ruby-on-rails-and-passenger/
答案 1 :(得分:-1)
尝试在生产机器上运行:
bundle exec rake assets:precompile