■Basic認証、IP制限 設定例 ------------------------ Basic認証(ID/パスをサーバで要求)Apache(.htaccess) ------------------------ 1)db_tool.php があるディレクトリに .htaccess を作成(または追記) AuthType Basic AuthName "Restricted" AuthUserFile /full/path/to/.htpasswd Require valid-user 2).htpasswd を作成(サーバ上で実行) # 初回は -c、2回目以降は -c を付けない htpasswd -c /full/path/to/.htpasswd youruser # パスワード入力を求められます ------------------------ Basic認証(Nginx) ------------------------ server { … } の対象 location に追加: location /path/to/dbtool/ { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; # htpasswd 形式 } ------------------------ IP制限(許可したIPだけ通す)Apache/Nginx ------------------------ 1)Apache(.htaccess, 2.4以降) Require ip 203.0.113.10 2001:db8::/32 # それ以外は拒否 Require all denied 2)Nginx location /path/to/dbtool/ { allow 203.0.113.10; # 固定グローバルIP allow 2001:db8::/32; # IPv6の範囲 deny all; }