特定の仮想ホストに対してのみApacheのようこそページを無効にしますか?

特定の仮想ホストに対してのみApacheのようこそページを無効にしますか?

Centos 7とApache 2.4を実行します。仮想ホストを使用してリポジトリを設定しながら、ドキュメントindex.htmlルートにファイルではなくディレクトリとディレクトリを表示できるようにしたいです。しかし、ブラウザからアクセスすると、Apacheテストページが表示されます。だから探してみると、/etc/httpd/conf.d/welcome.conf私がしなければならなかったことは、すべての行をコメントアウトするだけでした(テストしてみた結果、広告したように機能しました)。しかし、私はこの単一の仮想ホストではなく、すべてのサイトでこの機能を維持したいと思います。

仮想ホストごとにウェルカムページを無効にする方法は?

[michael@mybox main]$ cat /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.
#
# NOTE: if this file is removed, it will be restored on upgrades.
#
<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /.noindex.html
</LocationMatch>

<Directory /usr/share/httpd/noindex>
    AllowOverride None
    Require all granted
</Directory>

Alias /.noindex.html /usr/share/httpd/noindex/index.html
Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
[michael@mybox main]$

ベストアンサー1

適切な仮想ホストでオーバーライド

<LocationMatch "^/+$">
    Options +Indexes
</LocationMatch>

おすすめ記事