为什么 nginx+passenger 找不到某些 gem?

为什么 nginx+passenger 找不到某些 gem?

为什么 nginx+passenger 无法启动并将其打印到 error.log 中?

Could not find addressable-2.3.6 in any of the sources (Bundler::GemNotFound)
 /usr/local/share/gems/gems/bundler-1.7.8/lib/bundler/spec_set.rb:92...

我的 RoR 应用程序安装在 /var/www/html/ 中,并且我从该目录运行 bin/bundle:

$ bin/bundle install --deployment
Using addressable 2.3.6...
It was installed into ./vendor/bundle

宝石位于供应商/捆绑包下:

$ ls vendor/bundle/ruby/1.9.1/gems/ | grep address
addressable-2.3.6

Gemfile.lock 的一部分:

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.3.6)...

/etc/nginx/conf.d/passenger.conf 中的 Nginx 乘客配置:

passenger_root /usr/local/share/gems/gems/passenger-4.0.53/;
passenger_ruby /usr/bin/ruby; ...

/etc/nginx/sites-enabled/*.conf 中的 nginx 站点配置

passenger_enabled on;
passenger_set_cgi_param RAILS_ENV production;

我尝试设置passenger_set_cgi_param GEM_PATH /var/www/html/vendor/bundle/ruby/1.9.1/gems/:/usr/local/share/gems/gems/;但出现此错误:

Message from application: cannot load such file -- bundler/setup (LoadError)
  /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'...

相关内容