0

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.

1

Make sure you don't have an .htaccess file in /var/www with its own Options - it may be overriding your Directory block.

Also, /var/www is likely your document root and may be inheriting some other default options with higher precedence. Try moving your script to a new directory called, for example, /var/www/ruby; and modifying your Directory block accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.