[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[linux-users:96012] [解決]Re: public_htmlでCGIが動かない


ワタナベです。
表題の件は、自己解決しました。
ご助言いただきました。内海さん、荒木さん、馬渕さん、中村さん、ありがとうござ 
いました。


原因はhttpd.confの内容にありました。
次のような設定の場合、あるCGIスクリプトが<A>内では動作するが、<B>内 
では動作しないという問題でした。

#####################
#ScriptAlias /cgi-bin/ "/home/httpd/html/cgi-bin"

#<A>
<Directory "/home/httpd/html/cgi-bin">
	Options ExecCGI FollowSymLinks Includes IncludesNoExec
	Order allow,deny
	Allow from all
	DefaultType application/x-httpd-cgi
</Directory>

#<B>
<Directory "/home/*/public_html/cgi-bin">
	Options ExecCGI FollowSymLinks Includes IncludesNoExec
	Order allow,deny
	Allow from all
	DefaultType application/x-httpd-cgi
</Directory>

AddHandler cgi-script .cgi
AddHandler cgi-script .pl
######################


ScriptAliasがここでは、コメントアウトされていますが、どちらにしても変化ありま 
せんでした。
ひっかかったのは、一番下のAddHandlerの部分でした。

Apache付属のhttpd.confでは、その直前に

# もし、SSIを利用したい場合や、ScriptAliasされたディレクトリ外でCGIを利用したい
# のならば、次からの行のコメントをはずしてください。

というコメントがついているため、こうしておくと、DocumentRoot以下のディレクト 
リに適応されるように理解していましたが、そうではなく、個別に追加しないと効果 
がないみたいです。

そこで以下のように書き換えると、どちらでも問題なく動作するようになりました。

#####################
#ScriptAlias /cgi-bin/ "/home/httpd/html/cgi-bin"

#<A>
<Directory "/home/httpd/html/cgi-bin">
	Options ExecCGI FollowSymLinks Includes IncludesNoExec
	Order allow,deny
	Allow from all
	AddHandler cgi-script .cgi
	AddHandler cgi-script .pl
	AddType application/x-httpd-cgi .cgi
	AddType application/x-httpd-cgi .pl
</Directory>

#<B>
<Directory "/home/*/public_html/cgi-bin">
	Options ExecCGI FollowSymLinks Includes IncludesNoExec
	Order allow,deny
	Allow from all
	AddHandler cgi-script .cgi
	AddHandler cgi-script .pl
	AddType application/x-httpd-cgi .cgi
	AddType application/x-httpd-cgi .pl
</Directory>

AddHandler cgi-script .cgi
AddHandler cgi-script .pl
######################

この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
References: