Apacheのテストページを非表示にする方法

Apacheはルート直下に「index.html」ファイルがない場合に、デフォルトでテストページが表示される場合があります。

index.htmlを置けば解決しますが、ルート直下になにも置かない場合はテストページが表示されてしまいます。
テストページの非表示
テストページを非表示にしたい場合は「/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修正箇所は<LocationMatch>で囲まれた部分をコメントアウトします。
#<LocationMatch "^/+$">
# Options -Indexes
# ErrorDocument 403 /.noindex.html
#</LocationMatch>これでテストページが表示されなくなりました。
ファイル一覧が表示されてしまう場合
テストページは非表示になりましたが、このままではファイル一覧やサーバー情報が見えてしまいます。
403などを表示させたい場合は「/etc/httpd/conf/httpd.conf」を編集します。
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks「Options Indexes FollowSymLinks」の「indexes」の前に「-(ハイフン)」を付けて保存します。
これでApacheを再起動すれば、403 Forbiddenページが表示されるようになります。
ルート直下にファイルを置けば即解決なのですが、そうもいかない場合もあるので解決方法があることだけでも覚えておきましょう。



Google Maps APIでピンの見た目をカスタマイズする方法
CodeAnywhereでターミナルに触る練習をする
WordPressの自動バックグラウンド更新を無効にする方法とその注意点
Visual Studio CodeでMovable TypeのMTMLファイルを開く拡張機能「Movable Type Markup Language Syntax」
コーディングで「スペース」と「タブ」のどちらを使えばいいのか?
SourceTreeを開くと「’git status’ failed with code 69:’」というポップアップが出てくる場合の解決方法
iTerm2でさらに細かい機能の設定ができる環境設定の「Advanced」タブ
Visual Studio Codeの「Debugger for Chrome」でJavaScriptのデバッグを行う
AirPodsで片耳を外しても再生が止まらないようにする方法
MacのKeynoteにハイライトされた状態でコードを貼り付ける方法
iTerm2でマウスやトラックパッドの操作を設定できる環境設定の「Pointer」タブ
DeepLで「インターネット接続に問題があります」と表示されて翻訳できないときに確認すること
Ulyssesの「第2のエディタ」表示を使って2つのシートを横並びに表示する
高機能なスクリーンショットアプリ「CleanShot X」
macOSの効率化に関するDiscordコミュニティ「CMD-F」を立ち上げました
1Passwordの開発者向け機能(SSH Agent / Environments / 1Password CLI / Developer Watchtower)
Default Folder Xで保存ダイアログ内のファイルリストにフォーカスする方法
Obsidianで整理した知識をAnkiで定着させる方法
Figma × Keyboard Maestroでどこまで効率化できる?
マウス操作の完成度が高いウインドウリサイズアプリ「Magnet」
Macで複数ディスプレイを使っている場合に便利な設定集
AppCleanerでMacアプリを関連ファイルごと完全に削除する
操作に没頭できる!Firefox版 Arcのようなブラウザ「Zen Browser」