もくじ
こういう時!
- 身内向けの向けのコンテンツの公開
- 不特定多数に見せたくはないが、ガチガチにセキュリティで管理する必要はない
- 利便性は欲しいからインターネットでカジュアルにブラウザ閲覧したい
- Googleにインデックスされたり、想定していないアクセスは制御したい
そういう用途ってあるのですよね。
IPでの直接アクセス禁止
# vi /etc/httpd/conf.d/ignoreDirectIpAccess.conf
<VirtualHost *:80>
ServerName any
<Location />
Order Deny,Allow
Deny from all
</Location>
</VirtualHost>
反映する
# systemctl reload httpd
Indexページで404を返す
PHPのインストール
# yum -y install php # systemctl restart httpd
404を返す
# vi /var/www/vhosts/example.com/index.php
<?php
header("HTTP/1.1 404 Not Found");
include ('404.php');
exit;
バージョン情報の秘匿
# vi /etc/httpd/conf/httpd.conf
<IfModule dir_module>
DirectoryIndex index.php index.html ←●DirectooryIndexにindex.phpを加える
</IfModule>
※最終行に追加
# Apache version Hide
ServerTokens ProductOnly
ServerSignature off
反映する
# systemctl reload httpd

