【问题标题】:Problems installing Ruby on rails with apache2 on ubuntu在 ubuntu 上使用 apache2 在 Rails 上安装 Ruby 时出现问题
【发布时间】:2012-04-27 21:17:15
【问题描述】:

使用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'

【问题讨论】:

  • 请添加有关您如何解决此问题的更多信息。我正试图让它工作并得到“没有这样的文件要加载——phusion_passenger/utils”,以及一个 500 错误。你用过 libapache2-mod-passenger 吗?还是您使用了乘客 gem 和乘客安装 apache2 模块?

标签: ruby-on-rails apache2 ubuntu-server


【解决方案1】:

我遇到了同样的问题,然后我通过 gems 安装乘客来解决它。

访问 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/

【讨论】:

    【解决方案2】:

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

    bundle exec rake assets:precompile
    

    【讨论】:

    • 它给出消息“/usr/bin/ruby1.8 /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets”(为什么使用 ruby​​1.8 是一个新问题 - 我安装了 1.9.2)(额外信息:Bundle exec ruby​​ --version 给我“ruby 1.9.2”)这样做后我仍然遇到同样的错误。
    • 错误可能来自 1.8 解释器正在执行的仅 1.9 代码。您可以在终端中尝试ruby -v 吗?另外,如果你做sudo bundle exec ruby --version怎么办?可能是您在使用 RVM 时安装了 Ruby,但 Apache 以不同的用户身份运行。
    • 但是给了我 1.9.2 版本。正如你所说,apache 在不同的用户上运行。但我的用户和 sudo 都使用 1.9.2。我还尝试登录 apache 用户并执行“ruby -v”,它也使用 1.9.2
    • 好吧,看来我在那里有一个小 pebcak。使用与同一问题相关的更多信息和新错误更新原始帖子。
    • 案例已解决,现在我只需要安装缺少的 gem。我现在真的很傻。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-22
    相关资源
    最近更新 更多