2016-02-26 40 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。 祝你好運。