2017-10-11 99 views
0
Rails 5.1 
Ruby 2.4 
Ubuntu 16.04 
Passenger 5.1.8 

我的Gemfile沒有一個乘客寶石捆紮機找不到乘客的寶石

我的Apache2虛擬主機的配置文件看起來是這樣的:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName myapp.com 
    DocumentRoot "/home/utils/rails/public" 
    PassengerRuby /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby 
    PassengerAppEnv production 
    PassengerFriendlyErrorPages on 
    <Directory "/home/utils/rails/public"> 
     Allow from all 
     Options -MultiViews 
     Require all granted 
    </Directory> 
    LogLevel warn 
    ErrorLog ${APACHE_LOG_DIR}/follower_wonk_error.log 
    CustomLog ${APACHE_LOG_DIR}/follower_wonk_access.log combined 
</VirtualHost> 


ls -l /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby 

給我:

-rwxrwxr-x 1 utils utils 274 Oct 11 14:50 /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby 

和mods-available/passenger.conf中有:

<IfModule mod_passenger.c> 
    PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini 
    PassengerDefaultRuby /usr/bin/passenger_free_ruby 
</IfModule> 

但是,當我做

curl http://myapp.com 

我得到一個異常。我複製了擴展的錯誤HTML文件,這是它的一部分:

-------- The exception is as follows: ------- 

Could not find passenger-5.1.8 in any of the sources (Bundler::GemNotFound) 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/spec_set.rb:87:in `block in materialize' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `map!' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `materialize' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/definition.rb:159:in `specs' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/definition.rb:218:in `specs_for' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/definition.rb:207:in `requested_specs' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/runtime.rb:109:in `block in definition_method' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/runtime.rb:21:in `setup' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler.rb:101:in `setup' 
    /home/utils/.rvm/gems/ruby-2.4.2/gems/bundler-1.15.4/lib/bundler/setup.rb:19:in `<top (required)>' 
    /home/utils/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    /home/utils/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem' 
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code' 
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler' 
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>' 

但乘客5.1.18是存在的。

我也跑:

rvmsudo passenger-config validate-install 

和我:

Everything looks good. :-) 

用於客運和Apache

任何想法?

回答

1

如果您使用的是Apache,那麼您不需要Gemfile中的require位,那就是使用rails serverhttps://www.phusionpassenger.com/library/dev/ruby/rails_integration.html#rails-server-integration

+0

那麼,那麼apache配置文件中的PassengerRuby /home/utils/.rvm/gems/ruby-2.4.2/wrappers/ruby指令也不需要嗎? – EastsideDeveloper

+0

是的,需要。這告訴乘客使用哪個Ruby解釋器。 ',要求:「phusion_passenger/rack_handler」將乘客集成到軌道服務器命令中。它們完全不相關,因爲'PassengerRuby'是一個apache配置,'require'啓動乘客獨立。 –

+0

好的,我失去了你。我沒有在任何地方使用 – EastsideDeveloper

相關問題