为什么 mod_passenger.so 会出现此权限错误?

发布于 2025-01-06 23:01:13 字数 1122 浏览 0 评论 0原文

我正在设置带有 RVM 和 Passenger 的生产 RHEL 6 服务器。我已经完成了安装 RVM(到我的主目录)、安装 Passenger 并将所需的行添加到 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

但是当我重新启动 Apache 时,我收到此错误...

$ 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]

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

有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

亚希 2025-01-13 23:01:13

$ sudo setenforce 0

帮助了我

希望它能帮助其他人!

更新

我不得不说上面的解决方案是暂时的(直到重新启动),

所以,就这个答案而言,让我展示如何完全禁用 SELinux...

这里是:

运行

$ sudo vi /etc/sysconfig/selinux

$ sudo vi /etc/selinux/config

然后查找此行

SELINUX=enforcing

并更改它以

SELINUX=disabled

保存 selinux 配置。

现在 SELinux 已完全禁用。

干杯

$ sudo setenforce 0

helped me

hope it help others!

UPDATE

i have to say that above solution is temporal (until reboot)

so, as far as this answer has popularity let me show how to disable SELinux at all...

here it is:

run

$ sudo vi /etc/sysconfig/selinux

or

$ sudo vi /etc/selinux/config

then find this line

SELINUX=enforcing

and change it to

SELINUX=disabled

save selinux config.

now SELinux is fully disabled.

cheers

亢潮 2025-01-13 23:01:13

事实证明这与 SELinux 有关。

Passenger 文档在此处对此进行了讨论。

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

passenger-config --root

然后运行此...

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文