为什么 mod_passenger.so 会出现此权限错误? [英] Why is this permissions error occurring with mod_passenger.so?

查看:59
本文介绍了为什么 mod_passenger.so 会出现此权限错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RVM 和 Passenger 设置生产 RHEL 6 服务器.我已经安装了 RVM(到我的主目录),安装了Passenger,并将所需的行添加到httpd.conf:

LoadModulepassenger_module/home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.soPassengerRoot/home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11乘客Ruby/home/em/.rvm/wrappers/ruby-1.9.2-p290@rails_3_production/ruby

但是当我重新启动 Apache 时出现此错误...

$ sudo/sbin/service httpd restart停止 httpd:[失败]启动 httpd:httpd:/etc/httpd/conf/httpd.conf 的第 218 行语法错误:无法加载/home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so 进入服务器:/home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so:无法打开共享对象文件:权限被拒绝[失败的]

在实验中,我将从 ~/.rvm/... 开始的整个路径设置为 777,但我仍然遇到同样的错误.

有什么想法吗?

解决方案

原来与 SELinux 有关.

Passenger 文档对此进行了讨论

安装Passenger后,找到Passenger根目录...

passenger-config --root

然后运行这个...

chcon -R -h -t httpd_sys_content_t/path-to-passenger-root

I'm setting up a production RHEL 6 server with RVM and Passenger. I've gotten through installing RVM (to my home dir), installing Passenger, and adding the required lines to httpd.conf:

LoadModule passenger_module /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11
PassengerRuby /home/em/.rvm/wrappers/ruby-1.9.2-p290@rails_3_production/ruby

But when I restart Apache I get this error...

$ sudo /sbin/service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: httpd: Syntax error on line 218 of /etc/httpd/conf/httpd.conf: Cannot load /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so into server: /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so: cannot open shared object file: Permission denied
                                                           [FAILED]

Experimentally, I set the whole path starting at ~/.rvm/... to 777, but I'm still getting that same error.

Any thoughts?

解决方案

It turned out to have to do with SELinux.

The Passenger docs discuss it here.

After you install Passenger, find the Passenger root...

passenger-config --root

Then run this...

chcon -R -h -t httpd_sys_content_t /path-to-passenger-root

这篇关于为什么 mod_passenger.so 会出现此权限错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆