Last-modified: 2011-12-26 (月) 01:24:42
Apache/Apacheのバージョン情報などを隠したい

概要

HTTPレスポンスヘッダに含まれるApacheなどのバージョン情報内容を、簡易なものに置き換えます。

手順

  1. <Apacheルート>/conf/httpd.confを開きます。
    以下の設定を追加します。
    Everything is expanded.Everything is shortened.
      1
      2
    
    -
    !
    
    # Full > OS > Min > Minor > Major > Prodの順で表示する情報量が変化します
    ServerTokens Prod
  2. Apacheを再起動します。
    Everything is expanded.Everything is shortened.
      1
    
     
    
    /etc/init.d/httpd restart
  3. HTTPレスポンスヘッダを確認します。
    今回はlynxで確認しました。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
    
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    
    lynx -head -dump <URL>
     
    HTTP/1.1 200 OK
    Date: Wed, 08 Dec 2010 15:14:47 GMT
    Server: Apache
    Accept-Ranges: bytes
    Cache-control: no-cache
    Pragma: no-cache
    Content-Type: text/html; charset=UTF-8
    X-Pad: avoid browser bug
    Vary: Accept-Encoding
    Connection: close
     
    [Server:]欄が「Apache」となっていれば成功です。

検証時の環境

参考