【问题标题】:Passenger Apache2 CentOS RVM Permission denied on startup乘客 Apache2 CentOS RVM 权限在启动时被拒绝
【发布时间】:2016-06-09 02:36:57
【问题描述】:

我一直在关注一些在线教程来尝试设置我的 rails 应用程序。 似乎有一个权限配置,我试图修复它,但没有任何运气。

我使用的是 Ruby 2.3.0。 我有一个名为 deploy 的用户(执行 Capistrano 任务)和另一个 sudoer jwang。即使通过两个用户,我也将 rvm 安装为多用户安装。

这是日志中的错误:

App 1780 stderr: /etc/profile.d/rvm.sh: line 35:  /home/deploy/.rvm/scripts/rvm: Permission denied
App 1780 stderr: /bin/bash: /home/deploy/.bash_profile: Permission denied
App 1780 stdout: 
App 1780 stderr: *** ERROR ***: Cannot execute /home/deploy/.rvm/gems/ruby-2.3.0/wrappers/ruby: Permission denied (13)

这是我当前站点的配置文件。

<VirtualHost *:80>
ServerName creste.ca

# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/creste/current/public

PassengerRuby /home/deploy/.rvm/gems/ruby-2.3.0/wrappers/ruby

# Relax Apache security settings
<Directory /var/www/creste/current/public>
  Allow from all
  Options -MultiViews
  # Uncomment this if you're on Apache >= 2.4:
  Require all granted
</Directory>

任何见解将不胜感激。

【问题讨论】:

  • 什么命令,导致错误?
  • 当我尝试使用 sudo systemctl restart httpd 启动服务器并从浏览器查看页面时,它告诉我查看日志。

标签: ruby-on-rails apache centos rvm passenger


【解决方案1】:

SELinux 问题...以 sudo 用户身份安装 rvm...

【讨论】:

  • 欢迎来到 SO。请先转至HELP center,然后阅读How do I write a good answer?。这更像是一个评论。要发表评论,您需要获得更多特权。在此之前,请仅回答问题的实际解决方案
【解决方案2】:

我之前和你有同样的问题,我就是这样解决的:

尝试使用 set config PassengerUser https://www.phusionpassenger.com/library/config/apache/reference/#passengeruser 。使用安装 rvm 时使用的用户设置它。 因为您将 rails 应用程序放在了 apache/www-data 拥有的 /var/www/ 上,所以您需要指定拥有 rvm 的用户。

因此,根据您的示例,只需添加: PassengerUser deploy 在您的 apache 配置上的 PassengerRuby 配置之后或之前。

别忘了重启 apache。 祝你好运。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-21
    • 2020-08-25
    • 2015-09-16
    • 2011-08-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多