Back

rbenv + passenger: no such file to load: rubygems/path_support

发布时间: 2013-04-03 02:28:00

refer to: http://stackoverflow.com/a/15777738/445908

In my case, I also met this problem: ( My environment: Centos 5.8, rbenv 1.9.3p327, passenger 3.0.19, nginx( compiled and installed by passenger) . I googled around but didn't find any direct answer ( keyword: `rbenv, passenger, cannot load such file -- rubygems/path_support `), so I write my solution here.

I have checked and set nginx user to root, not works. and changed all the privileges of gem folder to 777. not works.

finally I got the solution: add these 2 lines of code to your Nginx config file:

    passenger_default_user root;
    passenger_default_group root;

so now your nginx config fie looks like:

    # /opt/nginx/config/nginx.conf
    user  root;  # seems this line of code doesn't take effect.
    http {
      passenger_root /root/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/passenger-3.0.19;
      passenger_ruby /root/.rbenv/versions/1.9.3-p327/bin/ruby;

      # these lines are the key!!!
      passenger_default_user root;
      passenger_default_group root;

      server {
        listen 80;
        root ;
        passenger_enabled on;
      }
    }

Back