0

使用http://www.modrails.com/install.html上的指南,我安装了 Ruby on rails 和 phusion-passenger 以使用 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)

任何熟悉此错误的人 - 并想帮助我?

据我了解,这个errorlinge是解决问题的关键,但是谷歌搜索并没有对我有太大帮助。

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- phusion_passenger/utils (LoadError)

编辑:我发现我的第一个错误是我在 apache 的 mods-enables 文件中写了“bun”而不是“bin”。因此没有将其指向正确的 ruby​​ 目录。

我现在收到乘客产生的错误。说以下:

Ruby (Rack) application could not be started
Error message:
    no such file to load -- bundler

然后它继续进行很长的回溯,我将在这里发布一个简短的片段:

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'
4

2 回答 2

1

我有同样的问题,然后我通过 gems 安装乘客来修复它。

访问 Phusion Passenger (mod_rails) 网站以获取有关 Passenger 的完整文档。您需要安装 GCC 来设置乘客。

通过 Gem 安装乘客

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/

于 2013-11-13T21:37:53.537 回答
-1

尝试在您的生产机器上运行它:

bundle exec rake assets:precompile
于 2012-04-27T21:19:29.127 回答