Search code examples
passengerrbenv

How to use rbenv with passenger?


I have a hard time trying to figure out how to use rbenv along with passenger. I'm running debian 6, so I installed passenger from oss-binaries.phusionpassenger.com repository. Then I installed rbenv, ruby-build and ruby and sinatra. Then I created a test application.

nginx.conf:

server {
    server_name a1;
    root   /home/yuri/a1/public;
    access_log   /var/log/nginx/a1-access.log;
    error_log   /var/log/nginx/a1-error.log;
    passenger_ruby   /home/yuri/.rbenv/shims/ruby;
    passenger_enabled   on;
}

~/a1/config.ru:

require './app'
run Sinatra::Application

~/a1/app.rb:

require 'sinatra'
get '/' do
    "Hello World!"
end

Here's what I see in browser, and in error.log.


Solution

  • The solution is to specify application-specific version of ruby:

    $ cd ~/a1
    $ rbenv local 1.9.3-p385