1
votes

I have embarked on what I thought would be a relatively easy task that has been anything but easy. I am new to Ruby on Rails and I'm trying to set up a AWS hosted Ubuntu 14.04 server that hosts Rails and Apache using Phusion Passenger 5.0.7. I created a new app and set my Apache config files to point to the app's public directory. When I load the IP address for the server, Passenger gives me the following error:

cannot load such file -- bundler/setup (LoadError)
  /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
  /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:399:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:277:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:404:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:276:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:99:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'

I've not had any trouble running "bundle install" so I'm sure bundler is available. Is this perhaps a permissions error or something misconfigured? I also noticed that Passenger reports RUBY_VERSION = 1.9.3 but when I type ruby -v, the installed version is ruby 2.2.2p95. I also noticed that in the error message, Passenger points to /usr/lib/ruby/1.9.1 for everything.

My Apache config file looks like this:

<VirtualHost *:80>
#    ServerName example.com
#    ServerAlias www.example.com
#    ServerAdmin webmaster@localhost
    PassengerLoadShellEnvvars off
#    PassengerRuby /home/ubuntu/.rvm/rubies/ruby-2.2.2/bin/ruby # I was trying to use the installed version of ruby since the default is showing 1.9.3 instead of the installed 2.2.2
    DocumentRoot /home/ubuntu/railsapps/railsest/public
    RailsEnv development
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory "/home/ubuntu/railsapps/railsest">
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>
1
Your issue is with what user is running bundle, apache or http user can't access it the same way your personal user can. You can edit /etc/apache2/http.conf to run apache as a different user.Stefan

1 Answers

0
votes

After re-compiling Passenger and adding the following lines to my Apache config file I was able to get the default rails "Welcome aboard" page to load.

   LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/passenger-5.0.7/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/passenger-5.0.7
     PassengerDefaultRuby /home/ubuntu/.rvm/gems/ruby-2.2.2/wrappers/ruby
   </IfModule>