简体   繁体   中英

Nginx/Passenger/Ruby error: Cannot execute ruby. Permission denied

After upgrading Passenger to 1.5.10 on Ubuntu, my rails app won't run. Passenger gives me an error:

Cannot execute /root/.rvm/gems/ruby-2.0.0-p451/wrappers/ruby: Permission denied (13)

The ruby executable path is valid, and I can run it from the command line. The file is owned by root:rvm, and nginx is running as www-data:www-data, so I figured that mismatch was the problem, but even when I change the ruby owner to www-data, I still have the same issue.

As far as I can tell from the Passenger tutorial, everything is set up correctly. From my nginx.conf:

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/local/rvm/gems/ruby-2.0.0-p451/wrappers/ruby;
passenger_user www-data;
passenger_group www-data;

And in the site configuration, I set passenger_enabled on .

So now I'm stumped and would be grateful for assistance.

Thanks to Cameron's comment ^, I discovered that I had set passenger_ruby to the wrong path in my nginx server block. The ruby executable specified there was under /root and therefore inaccessible to www-data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM