[Apacheメモ]httpd.confにOption Indexesを設定したにもかかわらずnoindex.htmlが表示される。

20111480

CentOS 5.7上のApacheでhttpd.confを編集してバーチャルホストを追加しました。

[kumacchi@rad-xen-vweb7 movie.kumacchi.com]$ sudo vi /etc/httpd/conf/httpd.conf
[sudo] password for kumacchi:
[kumacchi@rad-xen-vweb7 movie.kumacchi.com]$

<VirtualHost *:80>
    ServerAdmin example@kumacchi.com
    DocumentRoot /home/kumacchi/www/example.kumacchi.com
    ServerName example.kumacchi.com
    ErrorLog logs/example.kumacchi.com-error_log
    CustomLog logs/example.kumacchi.com-access_log common
</VirtualHost>

しかし最初の画像の様にApache Test Pageが表示されてしまいます。ディレクトリの中身を一覧したかったのでOption Indexesを設定したら直るかなと思い。他の設定箇所からコピペで持ってきて設定してみましたが変わりません。

<VirtualHost *:80>
    ServerAdmin example@kumacchi.com
    DocumentRoot /home/kumacchi/www/example.kumacchi.com
    ServerName example.kumacchi.com
    ErrorLog logs/example.kumacchi.com-error_log
    CustomLog logs/example.kumacchi.com-access_log common
    <Directory /home/kumacchi/www/example.kumacchi.com>
        AllowOverride All
        Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI IncludesNoExec
    </Directory>
</VirtualHost>

表示されているページがどこにあるのかは探してみると/var/www/error/noindex.htmlだという事は分かりました。

しかし/etc/httpd/conf/httpd.conf内を探してもそれを表示しようとしている設定がどこにもありません。

仕方が無いので検索してみると以下の記事を発見。

noindex.html @ ハイメ・予定は未定であって決定ではない・アルゲルスアリ

なるほど、/etc/httpd/conf.d/welcome.confでマッチするファイルがない場合はnoindex.htmlを表示するように設定されていました。

# 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>

 

そういうわけで
welcome.confをwelcome.conf.stopとリネームして

[kumacchi@rad-xen-vweb7 ~]$ sudo mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.stop

httpdを再起動して解決。これでちゃんとディレクトリの一覧がリストされるようになりました。

[kumacchi@rad-xen-vweb7 conf.d]$ sudo service httpd restart
[sudo] password for kumacchi:
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]
[kumacchi@rad-xen-vweb7 conf.d]$

 

で、この記事を書いているときに最初の画像を見ていると、おもいっきりそれらしいことが英語で書いてあるっぽいのが目に入りましたw。

20111480b

英語圏の人や普通に英語読めることだとこんな事で躓いたりしないんだろうなーと思ったり。

(Visited 75 times, 1 visits today)

タグ : , ,