Tips記事
» 2001年10月23日 00時00分 UPDATE

バーチャルホスト上でCGI/SSIが使えない

[木田佳克,ITmedia]

 Apacheでバーチャルホストを設定したものの,CGIが使えない。ここではサーバ側での設定を見直す手段の1つを紹介しよう。まず最初に,httpd.confの中で「<VirtualHost....」以下の設定内容を確認する。

 次のように設定されていれば,CGI,SSIが利用できるはずだ。

# vi /etc/httpd/conf/httpd.conf

〜中略〜

<VirtualHost www.xxxxx.jp>
ServerAdmin webmaster@xxxxx.jp
DocumentRoot /home/xxxxxx/public_html
ServerName www.xxxxx.jp
ServerAlias xxxxx.jp
ScriptAlias /cgi-bin/ "/home/xxxxx/public_html/cgi-bin/"
Addhandler cgi-script .cgi
Addhandler cgi-script .pl
Options Indexes Includes FollowSymLinks ExecCGI
UserDir disabled
ErrorLog /var/log/httpd/xxxxx-error_log
CustomLog /var/log/httpd/xxxxx-referer_log referer
CustomLog /var/log/httpd/xxxxx-agent_log agent
CustomLog /var/log/httpd/xxxxx-access_log combined
</VirtualHost>

 また,SSIの動作が不明な場合には,同じくhttpd.conf内で次の行を確認してみよう。次の例ではSSIが実行されるページには,拡張子がshtmlであることが前提になっている。

AddType text/html .shtml
AddHandler server-parsed .shtml

Copyright © ITmedia, Inc. All Rights Reserved.

注目のテーマ