質問

Hey I've deployed one of my Rails app in the server using phusion Passenger(4.0.20) and Rails 3.0.3 and Ruby ruby-1.8.7-p374. In the same system, we are managing other rails projects also with other Rails and Ruby versions. We are using RVM to manage rubies.

Doing rvm list shows:

rvm rubies

   ruby-1.8.7-p371 [ x86_64 ]
=* ruby-1.8.7-p374 [ x86_64 ]
   ruby-2.0.0-p353 [ x86_64 ]
   ruby-2.0.0-p451 [ x86_64 ]
   ruby-2.1.0 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

The project that I've problem while running is using ruby-1.8.7-p374 and Rails 3.0.3. Now when I take the URL, it shows the below given error. enter image description here

Restarted apache, restarted passenger, but we are getting issues with ruby-2.0.0-p451 which we have installed for managing another Rails application.

What could be the reason? Please help :)

役に立ちましたか?

解決 2

Go to the project directory and run the below commands one by one:

rvm use ruby-1.8.7-p374
gem install bundler passenger
rvm passenger-install-apache2-module

This will install passenger along with Apache module, mean while you will be asked to add some configuration changes to /etc/apache2/apache2.conf and do it as such.

Create a file in /etc/apache2/sites-available/ for your site (something like 'www.virtualx.com') and insert this:

<VirtualHost *>
    # Change these 3 lines to suit your project
    RailsEnv production
    ServerName www.virtualx.com
    DocumentRoot /var/www/my_project/public # Note the 'public' directory
</VirtualHost> 

and set the PassengerRuby option to ruby-1.8.7-p374.

Restart Apache service. You are all done.

Now it will work ok.

If you need multiple ruby versions working simultaneously for different projects, then refer here.

Hope it helps :)

他のヒント

Do you have a .ruby-version in your project directory? Your project is trying to load ruby-2.0.0-p451 instead of ruby-1.8.7-p374

Have a .ruby-version in your project dir with the set version you want, ie, ruby-1.8.7-p374 and try.

Use rvmrc or ruby-version file to set a project gemset with RVM?

I see two issues here:

  1. Phusion Passenger is trying to use /usr/local/rvm/gems/ruby-2.0.0-p451 as the Ruby interpreter to run your app. But /usr/local/rvm/gems/ruby-2.0.0-p451 is a directory, not an executable! Furthermore, you intend to run your app under ruby-1.8.7-p374, not ruby-2.0.0-p451. This means you didn't set your PassengerRuby option correctly. Read http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerRuby to learn how to set this correctly. There's even a section in the manual specifically about how to do this when you're using RVM.
  2. As you can see under "User and groups", Phusion Passenger is trying to execute your app as the "nobody" user. This is probably not what you intended! Use PassengerUser to change the user that your app is executed as.

On a side note, you should upgrade to the latest version of Phusion Passenger, 4.0.41, for the latest bug fixes.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top