Phusion Passenger 应用程序无法启动

Phusion Passenger application cannot be started

我遇到了一些问题,并且一直在互联网上搜索类似的问题,但我仍然卡住了。问题是关于 apache2 + phusion passenger。我在 raspberry pi 上托管。我已经设置了 apache2 和虚拟主机文件。但是当我测试应用程序时,我得到应用程序无法从 Phusion passenger 启动。

当我连接到外部 PC 上的本地主机时,Phusion Passenger 出错。日志文件:

[Mon Jan 11 22:37:07 2016] [notice] Apache/2.2.22 (Debian) Phusion_Passenger/3.0.13 PHP/5.4.45-0+deb7u2 configured -- resuming normal operations
[ pid=14842 thr=11296008 file=utils.rb:176 time=2016-01-11 22:37:10.346 ]: *** Exception LoadError in PhusionPassenger::Rack::ApplicationSpawner (cannot load such file -- bundler) (process 14842, thread #<Thread:0x158ba10>):
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:325:in `prepare_app_process'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/application_spawner.rb:156:in `block in initialize_server'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:572:in `report_app_init_status'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/application_spawner.rb:154:in `initialize_server'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb:204:in `start_synchronously'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb:180:in `start'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/application_spawner.rb:129:in `start'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
    from <internal:prelude>:10:in `synchronize'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    from /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:99:in `<main>'

这是我的 /apache2/sites-available 虚拟主机配置:

<VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot /var/www/testPage/public
    RailsEnv development
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory "/var/www/testPage/public">
        Options FollowSymLinks
    AllowOverride all
    </Directory>
</VirtualHost>

我还通过使用 a2ensite 将其切换为默认使用此配置。

ruby -v

ruby 2.2.2p95 (2015-04-13 revision 50295) [armv6l-linux-eabihf]

rails-v

Rails 4.1.8

gemfile 在我的 /www

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

尝试将文件夹的权限更改为 777

sudo chmod -r 777 folder_path.

然后运行再次捆绑重新启动apache2服务器

确保 Apache 用户可以访问 Phusion passenger。我假设您使用的是 Debian 发行版 Rasbpian。在这种情况下,Apache 用户可能是 www-data。如果您使用的是 CentOS、RedHat 或 Fedora,则默认的 Apache 用户名是 apache。然而,这只是默认设置。某些软件(例如 cPanel)可能会更改默认的 apache 用户。对于 cPanel,默认的 apache 用户称为 nobody。尝试以下命令强制执行 apache 访问。

sudo chown -R www-data:www-data /phusion/passenger/installation/path