Ruby on Rails,Passenger和Apache

时间:2015-05-06 14:20:27

标签: ruby-on-rails apache passenger

我已经开始了我认为相对容易的任务,但这并不容易。我是Ruby on Rails的新手,我正在尝试使用Phusion Passenger 5.0.7建立一个托管Rails和Apache的AWS托管的Ubuntu 14.04服务器。我创建了一个新的应用程序并将我的Apache配置文件设置为指向应用程序的公共目录。当我加载服务器的IP地址时,Passenger给我以下错误:

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

我没有遇到任何运行问题&#34;捆绑安装&#34;所以我确定捆绑器可用。这可能是一个权限错误或错误配置的东西?我还注意到Passenger报告RUBY_VERSION = 1.9.3但是当我输入ruby -v时,安装的版本是ruby 2.2.2p95。我还注意到,在错误消息中,Passenger指向/usr/lib/ruby/1.9.1以获取所有内容。

我的Apache配置文件如下所示:

<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 个答案:

答案 0 :(得分:0)

重新编译Passenger并将以下行添加到我的Apache配置文件后,我可以获得默认的“欢迎登陆”页面来加载。

Runtime classpath