【apache】Options Indexes が効かない?
問題
あるバーチャルホストの設定で、以下のような記述をして、ディレクトリの中のファイル一覧が見えるように設定したつもりだが、見えない。なぜ?
<Directory /home/apache/hogehoge/www>
Options +Indexes
</Directory>
答え
RPMでインストールしたapacheでは、/etc/httpd/conf.d/welcome.conf という設定ファイルがあり、以下のように、ディレクトリにアクセスしたときのエラードキュメントの設定がある。
#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL. To disable the Welcome page, comment
# out all the lines below.
#
<LocationMatch "^/+$">
Options -Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>
こちらの方が適用されて、403 Forbidden になるようです。
welcome.conf の設定は、先頭に # を入れて、コメントアウトして、apacheを再起動すると、大丈夫なはず。