Ruby on Rails, nginx, passenger on production server (cannot load such file — rubygems/path_support)

前端 未结 3 1072
没有蜡笔的小新
没有蜡笔的小新 2021-01-16 08:49

I installed:

  • Centos 6
  • Ruby 1.9.3-rc1
  • Passenger gem and passenger nginx module ( compiled against own source 1.1.6)
  • Installed rails 3
3条回答
  •  孤独总比滥情好
    2021-01-16 08:59

    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 file 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;
      }
    }
    

提交回复
热议问题