2004/07/27(火) [n年前の日記]
#3 [linux][vine] erubyとやらが動かない
_Ruby Earrings
にしたがって試してみたけど、.rhtml のURIを指定しても Not found といわれる。何故。.htaccess で Option +Indexes にして一覧を見てみたら、.rhtml は存在してる。eruby 〜.rhtml と打てば、たしかに解説ページどおりに出力される。うーん。
◎ わからん :
とりあえず mod_ruby とやらを入れてみたら状況が変わるだろうか。<いや、たぶん関係ないだろ。ということでインストールしてみたり。<人の話を聞けよ。
_こちらの方のメモ
に習って、apt-get install mod_ruby した後、/etc/httpd/conf/httpd.conf に、
Include conf/httpd.conf.mod_rubyを追加。/usr/sbin/httpd -t として、httpd.conf に誤りがないことを確認。/etc/rc.d/init.d/httpd start して、止めておいた httpd を起動。…変化無し。
◎ URIがおかしい :
/var/log/httpd/error_log を見てたら気がついた。/home/httpd/cgi-bin/eruby//~hoge/cgi-bin/eruby/test.rhtml みたいなURIになってる。「Action application/x-httpd-eruby /cgi-bin/eruby
」の指定が、ユーザに合った(?)指定になってないのかも。
◎ .htaccessに書くのはやめて :
/etc/httpd/conf/httpd.conf.mod_ruby の、ERubyRun とか *.rhtml の部分のコメントを外してみた。…動いたみたい。>eruby。であれば次は、ruby で書いた cgi が動くかどうか。とりあえず、今の httpd.conf.mod_ruby はこんな感じ。
LoadModule ruby_module modules/mod_ruby.so
# If the ruby module is installed, this will be enabled.
<IfModule mod_ruby.c>
# for Apache::RubyRun
RubyRequire apache/ruby-run
Alias /ruby/ /home/httpd/ruby/
# exec files under /ruby as ruby scripts.
<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options +ExecCGI
</Location>
# exec *.rbx as ruby scripts.
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
# for Apache::ERubyRun
RubyRequire apache/eruby-run
Alias /eruby/ /home/httpd/eruby/
# handle files under /eruby as eRuby files by eruby.
<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
Options ExecCGI
</Location>
# handle *.rhtml as eruby files.
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
# # for Apache::ERbRun
# RubyRequire apache/erb-run
#
# Alias /erb/ /home/httpd/erb/
# # handle files under /erb as eRuby files by ERb.
# <Location /erb>
# SetHandler ruby-object
# RubyHandler Apache::ERbRun.instance
# Options ExecCGI
# </Location>
# # for debug
# RubyRequire auto-reload
</IfModule>
コメント外しただけですが。後でファイル消失すると怖いのでメモっておくのです。
[ ツッコむ ]
以上です。