Debian etchでApache2 + Ruby
httpd.confに追記
mod_rubyやら。ディレクトリはてきとーに。
eRubyの関係で.rhtmlなど。
<Directory "/var/www">
AddType text/html .rhtml
ServerSignature Off
Options +ExecCGI
AddHandler cgi-script .rb
</Directory>
モジュール読み込みなど必要なかったので訂正。
テストしてみる
コメントアウトはグーグルさんにリダイレクト。
hello.cgi
#!/usr/bin/env ruby puts "Content-Type: text/html" puts print <<"EOB" hello EOB lists = [1,2,3] lists.each {|l| puts l } #Apache.request.headers_out['Location'] = 'http://google.com/' #exit(Apache::HTTP_MOVED_TEMPORARILY)
mod_rubyについては、ここを読めばいいらしい。http://arika.org/doc/debuan.mod_ruby.html.ja