我的环境如下:
- Ubuntu 10.04
- 红宝石 2.0.0
- 导轨 4.0
部署的 Rails 应用程序位于 /var/www/application。部署由 Capistrano 处理,因此,目录结构如下:
root@lvps91-250-114-42:/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
config/deploy.rb 配置为使用 :local ruby(已安装到 ../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 安装(位于 root :-() 中,并且我需要更改权限(但我没有更改它们):
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 中的可执行文件吗?
先感谢您!!
杰佩特科