使用rails获得Phusion Passenger错误

时间:2012-10-12 14:48:40

标签: ruby-on-rails ubuntu-12.04 passenger

使用Phusion Passenger设置rails应用程序时遇到了严重的问题。 当我在端口3000上运行Webrick服务器时,我的应用程序运行完美,但在尝试通过虚拟主机访问它时,我继续遇到乘客错误。这是信息:

乘客抛出错误

enter image description here enter image description here

服务器信息(在VMWare下)

  • 经销商ID:Ubuntu
  • 描述:Ubuntu 12.04.1 LTS(GNU / Linux 3.2.0-29-generic-pae i686)
  • 发布:12.04.1

Ruby和Rails版本

  • ruby -v = ruby​​ 1.9.3p194(2012-04-20修订版35410)[i686-linux]
  • rails -v = Rails 3.2.8
  • rvm -v = rvm 1.16.11(稳定)作者:Wayne E. Seguin,Michal Papis [https://rvm.io/]

Ruby和Rails位置

  • which ruby = /home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
  • which rails = /home/wae-group-4/.rvm/gems/ruby-1.9.3-p194/bin/rails
  • which rvm = /home/wae-group-4/.rvm/bin/rvm
  • which passenger = /home/wae-group-4/.rvm/gems/ruby-1.9.3-p194/bin/passenger

宝石清单

的结果
    *** LOCAL GEMS ***

    actionmailer (3.2.8)
    actionpack (3.2.8)
    activemodel (3.2.8)
    activerecord (3.2.8)
    activeresource (3.2.8)
    activesupport (3.2.8)
    arel (3.0.2)
    builder (3.1.2, 3.0.3)
    bundler (1.2.1)
    cgi_multipart_eof_fix (2.5.0)
    cocaine (0.3.1)
    coffee-rails (3.2.2)
    coffee-script (2.2.0)
    coffee-script-source (1.3.3)
    daemon_controller (1.0.0)
    daemons (1.1.9)
    erubis (2.7.0)
    execjs (1.4.0)
    fastthread (1.0.7)
    gem_plugin (0.2.3)
    hike (1.2.1)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (2.1.2)
    json (1.7.5)
    libv8 (3.3.10.4 x86-linux)
    mail (2.4.4)
    mime-types (1.19)
    multi_json (1.3.6)
    nokogiri (1.5.5)
    paperclip (3.0.4)
    passenger (3.0.17)
    pg (0.14.1)
    polyglot (0.3.3)
    rack (1.4.1)
    rack-cache (1.2)
    rack-ssl (1.3.2)
    rack-test (0.6.1)
    rails (3.2.8)
    railties (3.2.8)
    rake (0.9.2.2)
    rb-readline (0.4.2)
    rdoc (3.12)
    rubygems-bundler (1.0.7)
    rvm (1.11.3.5)
    sass (3.2.1)
    sass-rails (3.2.5)
    sprockets (2.1.3)
    sqlite3 (1.3.6)
    therubyracer (0.10.2)
    thor (0.16.0)
    tilt (1.3.3)
    treetop (1.4.10)
    tzinfo (0.3.33)
    uglifier (1.3.0)

捆绑列表的结果

    Gems included by the bundle:
      * actionmailer (3.2.8)
      * actionpack (3.2.8)
      * activemodel (3.2.8)
      * activerecord (3.2.8)
      * activeresource (3.2.8)
      * activesupport (3.2.8)
      * arel (3.0.2)
      * builder (3.0.3)
      * bundler (1.2.1)
      * cocaine (0.3.1)
      * coffee-rails (3.2.2)
      * coffee-script (2.2.0)
      * coffee-script-source (1.3.3)
      * erubis (2.7.0)
      * execjs (1.4.0)
      * hike (1.2.1)
      * i18n (0.6.1)
      * journey (1.0.4)
      * jquery-rails (2.1.2)
      * json (1.7.5)
      * libv8 (3.3.10.4)
      * mail (2.4.4)
      * mime-types (1.19)
      * multi_json (1.3.6)
      * nokogiri (1.5.5)
      * paperclip (3.0.4)
      * pg (0.14.1)
      * polyglot (0.3.3)
      * rack (1.4.1)
      * rack-cache (1.2)
      * rack-ssl (1.3.2)
      * rack-test (0.6.1)
      * rails (3.2.8)
      * railties (3.2.8)
      * rake (0.9.2.2)
      * rb-readline (0.4.2)
      * rdoc (3.12)
      * sass (3.2.1)
      * sass-rails (3.2.5)
      * sprockets (2.1.3)
      * therubyracer (0.10.2)
      * thor (0.16.0)
      * tilt (1.3.3)
      * treetop (1.4.10)
      * tzinfo (0.3.33)
      * uglifier (1.3.0)

rvm info的结果

      ruby-1.9.3-p194:

        system:
          uname:       "Linux web4 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux"
          system:      "ubuntu/12.04/i386"
          bash:        "/bin/bash => GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)"
          zsh:         " => not installed"

        rvm:
          version:      "rvm 1.16.11 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
          updated:      "4 hours 21 minutes 40 seconds ago"

        ruby:
          interpreter:  "ruby"
          version:      "1.9.3p194"
          date:         "2012-04-20"
          platform:     "i686-linux"
          patchlevel:   "2012-04-20 revision 35410"
          full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]"

        homes:
          gem:          "/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194"
          ruby:         "/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194"

        binaries:
          ruby:         "/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
          irb:          "/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
          gem:          "/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
          rake:         "/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194/bin/rake"

        environment:
          PATH:         "/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194/bin:/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194/bin:/home/wae-group-4/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
          GEM_HOME:     "/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194"
          GEM_PATH:     "/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194:/home/wae-group-4/.rvm/gems/ruby-1.9.3-p194@global"
          MY_RUBY_HOME: "/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194"
          IRBRC:        "/home/wae-group-4/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
          RUBYOPT:      ""
          gemset:       ""

Gemfile内容

    source 'https://rubygems.org'

    gem 'rails', '3.2.8'

    # Bundle edge Rails instead:
    # gem 'rails', :git => 'git://github.com/rails/rails.git'

    gem 'pg'


    # Gems used only for assets and not required
    # in production environments by default.
    group :assets do
      gem 'sass-rails',   '~> 3.2.3'
      gem 'coffee-rails', '~> 3.2.1'

      # See https://github.com/sstephenson/execjs#readme for more supported runtimes
      gem 'therubyracer', :platforms => :ruby

      gem 'uglifier', '>= 1.0.3'
    end

    gem 'jquery-rails'

    # To use ActiveModel has_secure_password
    # gem 'bcrypt-ruby', '~> 3.0.0'

    # To use Jbuilder templates for JSON
    # gem 'jbuilder'

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

    # Deploy with Capistrano
    # gem 'capistrano'

    # To use debugger
    # gem 'debugger'

    gem 'rb-readline'
    gem 'nokogiri'
    gem 'paperclip', '3.0.4'
    gem 'rack-test'

apache2.conf中的Passenger设置

    LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
    PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.17
    PassengerRuby /usr/bin/ruby1.8

/ etc / apache2 / sites-enabled

中的App Config
    <VirtualHost *:80>
          ServerName 192.41.170.115
          # !!! Be sure to point DocumentRoot to 'public'!
          DocumentRoot /home/wae-group-4/web12_04/ps2/public
          <Directory /home/wae-group-4/web12_04/ps2/public>
             # This relaxes Apache security settings.
             AllowOverride all
             # MultiViews must be turned off.
             Options -MultiViews
          </Directory>
    </VirtualHost>

/etc/apache2/ports.conf

的内容
    NameVirtualHost *:80
    Listen 80

    <IfModule mod_ssl.c>
        # If you add NameVirtualHost *:443 here, you will also have to change
        # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
        # to <VirtualHost *:443>
        # Server Name Indication for SSL named virtual hosts is currently not
        # supported by MSIE on Windows XP.
        Listen 443
    </IfModule>

    <IfModule mod_gnutls.c>
        Listen 443
    </IfModule>

捆绑安装的结果

    Using rake (0.9.2.2) 
    Using i18n (0.6.1) 
    Using multi_json (1.3.6) 
    Using activesupport (3.2.8) 
    Using builder (3.0.3) 
    Using activemodel (3.2.8) 
    Using erubis (2.7.0) 
    Using journey (1.0.4) 
    Using rack (1.4.1) 
    Using rack-cache (1.2) 
    Using rack-test (0.6.1) 
    Using hike (1.2.1) 
    Using tilt (1.3.3) 
    Using sprockets (2.1.3) 
    Using actionpack (3.2.8) 
    Using mime-types (1.19) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.10) 
    Using mail (2.4.4) 
    Using actionmailer (3.2.8) 
    Using arel (3.0.2) 
    Using tzinfo (0.3.33) 
    Using activerecord (3.2.8) 
    Using activeresource (3.2.8) 
    Using cocaine (0.3.1) 
    Using coffee-script-source (1.3.3) 
    Using execjs (1.4.0) 
    Using coffee-script (2.2.0) 
    Using rack-ssl (1.3.2) 
    Using json (1.7.5) 
    Using rdoc (3.12) 
    Using thor (0.16.0) 
    Using railties (3.2.8) 
    Using coffee-rails (3.2.2) 
    Using jquery-rails (2.1.2) 
    Using libv8 (3.3.10.4) 
    Using nokogiri (1.5.5) 
    Using paperclip (3.0.4) 
    Using pg (0.14.1) 
    Using bundler (1.2.1) 
    Using rails (3.2.8) 
    Using rb-readline (0.4.2) 
    Using sass (3.2.1) 
    Using sass-rails (3.2.5) 
    Using therubyracer (0.10.2) 
    Using uglifier (1.3.0) 
            Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

我这么多天都遇到过这样的问题。我应该重新安装rails,gem和rvm吗?任何帮助将不胜感激!

2 个答案:

答案 0 :(得分:6)

我已经有了解决方案。当我检查which passenger时,我发现有2个地方可能会导致一些冲突问题。由于之前的命令:

  • sudo gem install passenger
  • gem install passenger

然后我做

  • sudo gem uninstall passenger
  • gem uninstall passenger

并做

  • gem install passenger
  • passenger-install-apache2-module

我收回了我的申请。

答案 1 :(得分:1)

您是否在生产中尝试过bundle install和/或sudo bundle install