SSIを動かすのに、2時間掛かってしまいました。

mod_include

Apache1系とApache2系では設定が違うようで、Apache2の設定が書かれているサイトが少なく、苦労しました。
主原因はこれでした。ログを見ると下記表記がありました。

	> vi /var/log/apache2/error.log
	
	[Mon Apr 28 13:01:07 2008] [error] an unknown filter was not added: includes
				

SSIを機能させるモジュールが無いとこのようなエラーが出ます。そこで、mod_includeを追加。

	> cd /etc/apache2
	> a2enmod include
	Module include installed; run /etc/init.d/apache2 force-reload to enable.
	> /etc/init.d/apache2 reload
				

これで動くようになりました。

その他、SSIで必須の設定を記述します。

SSIの設定

.shtmlならSSIが動作するような場合の設定です。まずはapache2.conf

	vi /etc/apache2/apache2.conf
	
	<IfModule mod_mime.c>
	~中略~
    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
  </IfModule>
				

「AddType text/html .shtml」「AddOutputFilter INCLUDES .shtml」が必須です。Debian4.0では元々コメント(#)が外れていました。

次に、httpd.conf

	> vi /etc/apache2/sites-enabled/xxx
	Options FollowSymLinks ExecCGI Indexes Includes
				

Options の行の末尾に「Includes」を追記。

※バグなどがありましたら、ダウンロードしたソースにあるメールアドレスまでご一報ください。