Vps Apache Config - Invalid Command 'Passengerdefaultruby' After Adding Latest Passenger Gem

VPS apache config - Invalid command 'PassengerDefaultRuby' after adding latest passenger gem

Got it!

you need to have a default ruby assigned at root level, the other ones you'll set in sites-enabled configuration files. For example, in my apache2.conf file:

   LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby

then in /etc/apache2/sites-enabled/mysite that fires up the app that should work in ruby-1.9.3 I'll add PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby:

<VirtualHost xxx.xx.xx.xx:80>
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
ServerName mysite.md
DocumentRoot /home/apps/myapp/public
<Directory /home/apps/myapp>
AllowOverride None
Options -MultiViews
</Directory>
</VirtualHost>

for the app that works with ruby-2.0 no need to add PassengerRuby option as ruby-2.0 is the default one now.

Also if you have other rvm passenger modules loaded in apache2.config file, like in my case I had:

#   LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
# PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.18
# PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby

you'll need to remove them or comment them as I did, as you'll load the ruby version in /etc/apache2/sites-enabled/mysite config file.

note!

This will only work on passenger > 4.0.0. I have tested this on
passenger-3.0.8 and it does not work. Note that PassengerDefaultRuby
was introduced in passenger version 4.0.0, see
modrails.com/documentation/….

Passenger + Apache + Ruby

I reinstall all again (passenger only through rubygems) and it works fine.
So, it is my 'how to install passenger + apache + ruby':

  1. Install apache:

    sudo apt-get install apache2

  2. Install rvm

    \curl -sSL https://get.rvm.io | bash -s stable

  3. Install passenger through rubygems:

    gem install passenger

  4. Run the Phusion Passenger installer

    passenger-install-apache2-module

  5. Create your rack app like this

    in passenger doc example

  6. Add VirtualHost block to /etc/apache2/sites-enabled/rack_app

  7. Create /etc/apache2/mods-enabled/passenger.conf with PassengerRoot,
    PassengerDefaultRuby

  8. Create /etc/apache2/mods-enabled/passenger.load with LoadModule
    block

    sudo a2ensite rack_app
    sudo a2enmod passenger
    sudo service apache2 restart

Have fun!

For more details see comments in /etc/apache2/apache2.conf, and Passenger Apache Docs

cannot load such file -- bundler/setup (LoadError)

It could be that there was a previous Ruby env installed on your system prior to your installation of 2.0? This might have had an existing GEM_PATH that lead to the /1.8 directory which the installation of version 2.0 simply kept.

The problem you where likely having, then, was that Passenger/Apache was looking in the /2.0 directory when in fact the gems were in the /1.8 directory. Your explicitly telling apache to use the /1.8 directory thus makes sense to fix the problem.

SetEnv GEM_HOME /usr/lib/ruby/gems/1.8

You might also try using the Ruby Version Manager to handle multiple Ruby envs.

Some things I found in Google:

  • New to Ruby and am having trouble with LOAD_PATH
  • http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices/
  • http://guides.rubygems.org/faqs/

Passenger Apache Module install - installer not finding installed libraries

I was able to install the rvm, ruby and passenger as root, and the issue was fixed. Something to do with permission, when done as user. But I had to do some workarounds for the user related activities on the ruby part like bundle install, rake assets:precompile (had to do this as root, so gave sudo permission for the local user to perform these).

Nginx Passenger not serving Rails application

Finally I got it. Everything was all right. Passenger does not start apps during startup, but during the first request so all I needed to do it was press enter in my browser ... Hope that answer save time to others.

Phusion Passenger Error: You have activated rack 1.2.1, but your Gemfile requires rack 1.2.2

try to restart your server after edit in your Gemfile and put this: gem 'rack', '1.2.1'



Related Topics



Leave a reply



Submit