我的环境如下:使用乘客使用Rails和Apache 2/SpawnPreparer权限被拒绝
- 的Ubuntu 10.04
- 的Ruby 2.0.0
- 的Rails 4.0
部署的Rails应用程序驻留在/ var/www/application中。部署由Capistrano的处理,因此,目录结构如下:
[email protected]:/var/www/application# ls -la
total 16
drwxrwxr-x 4 www-data www-data 4096 2013-11-14 12:53 .
drwxr-xr-x 6 www-data www-data 4096 2013-11-12 22:54 ..
lrwxrwxrwx 1 www-data www-data 39 2013-11-14 12:53 current -> /var/www/application/releases/20131114115156
drwxrwxr-x 11 www-data www-data 4096 2013-11-14 12:51 releases
drwxrwxr-x 8 www-data www-data 4096 2013-11-13 01:49 shared
配置/ deploy.rb被配置为使用一个:本地红宝石(其已被安装到../shared)。 Capistrano酒店配置:
require 'bundler/capistrano'
require 'rvm/capistrano'
#....
set :bundle_flags, "--deployment"
set :default_shell, '/bin/bash -l'
set :rvm_ruby_string, :local
#....
before 'deploy:setup', 'rvm:install_rvm'
before 'deploy:setup', 'rvm:install_ruby'
也许是因为没有安装乘客时,这是公认另一个RVM/Ruby安装此起到了重要作用。乘客告诉我配置Apache 2如下:
LoadModule passenger_module /root/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.24/buildout/apache2/mod_passenger.so
PassengerRoot /root/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.24
PassengerDefaultRuby /root/.rvm/wrappers/ruby-2.0.0-p247/ruby
但抱怨我.rvm安装(位于根:-()和我将需要更改权限(但我没有改变它们):
It is recommended that you relax permissions as follows:
sudo chmod o+x "/root"
Press Ctrl-C to return to the shell. (Recommended)
After relaxing permissions, re-run this installer.
-OR-
Press Enter to continue anyway.
相应sites-enabled/application
配置:
<VirtualHost *:80>
ServerName subdomain.domain.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/application/current/public
<Directory /var/www/application/current/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
当我启动的应用程序,我在我的浏览器得到了以下错误:
Cannot execute "/root/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.24/buildout/agents/SpawnPreparer": Permission denied (errno=13)
后:
sudo chmod o+x "/root"
一切工作。
你有什么建议来解决它?我应该重新安装.rvm和乘客吗?我可以重新配置Apache配置,以便Apache可以访问驻留在/ var/www/application中的所有可执行文件吗?
预先感谢您!
jepetko
你是怎么解决这个问题的? – surfer190