2016-02-26 39 views
2

我一直在线下面试着设置我的rails应用程序。 它看起来像有一个权限配置,我试图解决它没有任何运气。乘客Apache2 CentOS RVM权限在启动时被拒绝

我正在使用Ruby 2.3.0。 我有一个用户称为部署(即执行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> 

任何有识之士将感激理解。

+0

什么命令会导致错误? –

+0

当我尝试使用sudo systemctl restart httpd启动服务器时,我从浏览器中查看该页面,它告诉我查看日志。 –

回答

0

SELinux的问题...安装RVM作为sudo的用户...

+0

欢迎来到SO。请先到[帮助中心](http://stackoverflow.com/help),然后阅读[我如何写出一个好的答案?](http://stackoverflow.com/help/how-to-answer)。这更多的是评论。为了评论,你需要获得更多的特权。在此之前,请仅以问题的实际**解决方案**回答问题。 – OldPadawan

0

我之前有同样的问题与你,这是我如何解决这个问题:

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

因此,基于您例如,只需添加: PassengerUser deploy 之后或之前PassengerRuby配置上的Apache配置。

不要忘记重新启动apache。 祝你好运。