"Options ExecCGI is off in this directory" When try to run Ruby code using mod_ruby
Posted
by
Itay Moav
on Server Fault
See other posts from Server Fault
or by Itay Moav
Published on 2011-05-24T20:06:29Z
Indexed on
2012/06/24
15:18 UTC
Read the original article
Hit count: 527
I am on Ubuntu,
Apache 2.2
Installed the fcgi via apt-get then removed it via apt-get remove.
Installed mod-ruby
configuration I added to Apache:
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>
I have a file in the www
direcoty with puts 'baba'
I have other files in that directory, all accessible via Apache.
Test file has been chmod 777
In the browser I get 403
.
In Apache error log I get:
[error] access to /var/www/t.rb failed for (null), reason: Options ExecCGI is off in this directory
If I move this to a sub folder rubytest
and modify the relevant config to be:
<Directory /var/www/rubytest>
Options +ExecCGI
</Directory>
and making sure the directory has 755 permissions on it, it just try to download the file, as if it does not recognize the postfix *.rb any more
If I give directory and files 777 it fails:
usr/lib/ruby/1.8/apache/ruby-run.rb:53: warning: Insecure world writable dir /var/www/rubytest in LOAD_PATH, mode 040777 [Tue May 24 19:39:58 2011] [error] mod_ruby: error in ruby [Tue May 24 19:39:58 2011] [error] mod_ruby: /usr/lib/ruby/1.8/apache/ruby-run.rb: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'
BUT, IF I USE *.rbx it works like a charm...go figure.
© Server Fault or respective owner