Rails Passenger Nginx 无法加载此类文件——bundler

Rails Passenger Nginx 无法加载此类文件——bundler

我在 Ubuntu Server 12.04LTS 上安装了 Rails、Passenger、nginx 和 PostgreSQL。但是,当我尝试访问应用程序/网站时,却看到一个错误页面,提示应用程序无法启动,因为缺少源文件Error message: cannot load such file -- bundler

我的 nginx 配置(/opt/nginx/conf/nginx.conf):

user railsapp;

worker_processes 1;
events {
  worker_connections 1024;
}

http {
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  keepalive_timeout 65;

  passenger_root /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14;
  passenger_ruby /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby;

  server {
     listen 80;
     server_name fitness_schedules.local;
     root /home/railsapp/fitness_schedules/public;
     passenger_enabled on;
     rack_env development;
  }
}

错误信息如下:

应用程序所需的源文件丢失。

可能是您没有正确上传应用程序文件。请检查是否已上传所有应用程序文件。可能未安装所需的库。请安装此应用程序所需的所有库。

有关错误的更多信息可能已写入应用程序的日志文件。请检查它以分析问题。

错误消息:无法加载此类文件——bundler

异常类:LoadError

应用程序根目录:/home/railsapp/fitness_schedules

以下是 nginx 呈现的网页回溯:

Backtrace:
#   File    Line    Location
0   /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  36  in `require'
1   /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  36  in `require'
2   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/utils.rb   325 in `prepare_app_process'
3   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/application_spawner.rb    156 in `block in initialize_server'
4   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/utils.rb   563 in `report_app_init_status'
5   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/application_spawner.rb    154 in `initialize_server'
6   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
7   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 180 in `start'
8   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/application_spawner.rb    129 in `start'
9   /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   253 in `block (2 levels) in spawn_rack_application'
10  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb  132 in `lookup_or_add'
11  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   246 in `block in spawn_rack_application'
12  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb  82  in `block in synchronize'
13      prelude>    10:in `synchronize'
14  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb  79  in `synchronize'
15  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   244 in `spawn_rack_application'
16  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   137 in `spawn_application'
17  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb   275 in `handle_spawn_application'
18  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'
19  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'
20  /home/railsapp/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/helper-scripts/passenger-spawn-server    99  in `'

其中~/fitness_schedules/log只有开发和测试日志,没有生产/开发日志。

答案1

我发帖后立即找到了答案;抱歉,8小时限制后我花了一段时间才回复这个问题……

/opt/nginx/conf/nginx.conf文件中,我必须替换

passenger_ruby /home/railsapp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby

passenger_ruby /home/railsapp/.rvm/wrappers/ruby-1.9.3-p194/ruby

相关内容