1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

サーバのバージョンは隠そう

Posted at

はじめに

  • HTTPレスポンスヘッダーにはPHPやnginxのバージョン情報が含まれる。
  • 本番環境などでは、PHPやnginxのようなサーバ側の設定でバージョンを含めないようにする必要がある。

なぜ隠す必要があるのか

  • 使用中のバージョンの脆弱性が明らかになった場合に攻撃の対象にされやすい。
  • 攻撃に有用な情報を取得される可能性がある。

設定について

簡単にですが、PHPとnginのバージョンの非表示の設定について記載しておきます。

PHPの設定

  • php.iniを開く

  • php.iniを以下のように修正する。

expose_php = On

の記述を

expose_php = off

に変更する。

nginxの設定

  • nginx.confのhttpディレクティブに server_tokens off; を追加
http {
    server_tokens off;
    ~

確認方法

  • chromeのNetworkタブからHTTPレスポンスヘッダーを確認する。

  • chromeの拡張機能のwappalyzerなどを使用する。

おわりに

バージョンを非表示にしていないことで、セキュリティ上のリスクが高まることになります。
本番環境を作る際などには気をつけましょう。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?