我是linux和rails的新手,我正在尝试启动并运行开发服务器。我已经安装了ruby / rails并让它在localhost:3000下运行。我可以创建一个rails应用程序并让它运行。
然后我安装了apache 2 / passenger。当我尝试命中机器的IP地址时,我收到以下错误:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:
bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:
Is this app supposed to be run as the a-cjstewar user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------
Could not find rake-12.0.0 in any of the sources (Bundler::GemNotFound)
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/spec_set.rb:87:in `block in materialize'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/spec_set.rb:81:in `map!'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/spec_set.rb:81:in `materialize'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/definition.rb:159:in `specs'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/definition.rb:218:in `specs_for'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/definition.rb:207:in `requested_specs'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:109:in `block in definition_method'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:21:in `setup'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler.rb:101:in `setup'
/var/lib/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/setup.rb:19:in `<top (required)>'
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/2.3.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>'
这是我的app1.conf文件:
<VirtualHost *:80>
ServerName 122.112.8.102
ServerAdmin user@email.com
DocumentRoot /home/username/app1/public
RailsEnv development
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/home/username/app1/public">
Require all granted
Options FollowSymLinks
# This relaxes Apache security settings.
AllowOverride None
# MultiViews must be turned off.
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
rails -v
Rails 5.1.2
apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
乘客-v
Phusion Passenger 5.1.6
我不知道从哪里开始。任何帮助表示赞赏!
答案 0 :(得分:1)
您似乎正在使用与您认为不同的Ruby运行应用程序。
为了获得你说你的应用应该运行的Ruby 2.4.0p0,你应该找到Ruby所在的位置
which ruby
然后,您可以使用PassengerRuby
中的<VirtualHost>
指令将该可执行文件设置为要使用的Ruby:
<VirtualHost *:80>
PassengerRuby: /path/to/ruby
# other stuff
</VirtualHost>