“选项ExecCGIclosures在这个目录”当试图运行使用mod_ruby的Ruby代码

我在Ubuntu上,
Apache 2.2通过apt-get安装了fcgi,然后通过apt-get remove将其删除。
安装mod-ruby
我添加到Apache的configuration

LoadModule ruby_module /usr/lib/apache2/modules/mod_ruby.so RubyRequire apache/ruby-run <Directory /var/www> Options +ExecCGI </Directory> <Files *.rb> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> <Files *.rbx> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> 

我有一个文件在www direcoty与puts 'baba'
我在该目录中有其他文件,都可以通过Apache访问。
testing文件已被chmod 777
在浏览器中,我得到403
在Apache错误日志中,我得到:

 [error] access to /var/www/t.rb failed for (null), reason: Options ExecCGI is off in this directory 

如果我把这个移动到一个子文件夹rubytest并修改相关的configuration为:

 <Directory /var/www/rubytest> Options +ExecCGI </Directory> 

并确保该目录上有755个权限,它只是试图下载该文件,就好像它不能识别后缀* .rb一样

如果我给目录和文件777失败:

usr / lib / ruby​​ / 1.8 / apache / ruby​​-run.rb:53:警告:不安全的可写dir / var / www / ruby​​test在LOAD_PATH,mode 040777 [Tue May 24 19:39:58 2011] [error] mod_ruby :错误在ruby[星期二2011年5月24日19时39分58秒] [错误] mod_ruby:/usr/lib/ruby/1.8/apache/ruby-run.rb load': loading from unsafe file /var/www/rubytest/t.rb (SecurityError) [Tue May 24 19:39:58 2011] [error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in 53:in load': loading from unsafe file /var/www/rubytest/t.rb (SecurityError) [Tue May 24 19:39:58 2011] [error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in handler'

但是,如果我使用* .rbx它就像一个魅力…去图。

确保在/var/www带有自己Options.htaccess文件 – 它可能会覆盖你的Directory块。

另外, /var/www可能是您的文档根目录,可能会inheritance更高优先级的其他默认选项。 尝试将你的脚本移动到一个新的目录,例如/var/www/ruby ; 并相应地修改您的Directory块。