Search code examples
ruby-on-railsapache2ubuntu-server

Problems installing Ruby on rails with apache2 on ubuntu


Using the guide found on http://www.modrails.com/install.html I installed Ruby on rails and phusion-passenger for deployment with apache2. (on ubuntu-server) (This is not the development server). The rails script works fine when i run "rails -s", but when I try to access the server using apache I get a "500 - Internal server error".

The error file from 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)

Anyone familiar with this error - and feels like helping me our?

As far as I understood this errorlinge is key to figuring out the issue, but googeling and did not help me much.

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

Edit: I found out my first error was that I wrote "bun" and not "bin" in the mods-enables file in apache. And thus not pointing it to a correct-ruby directory.

I now get an error generated by passenger. Saying the following:

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

And then it goes on with a long backtrace, i will post a short snippitt here:

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'

Solution

  • I had the same issue, then I fixed it by installing passenger via gems.

    Visit the Phusion Passenger (mod_rails) website for complete documentation on Passenger. You will need GCC installed to setup passenger.

    Install Passenger via Gem

    gem install passenger
    

    Run the passenger install script for apache2

    passenger-install-apache2-module
    

    Put the following in /etc/httpd/conf.d/passenger.conf (better to copy direct from the passenger-install-apache2-module output)

    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
    

    Original guide is in http://www.interworx.com/support/faq/how-to-install-ruby-on-rails-and-passenger/