Hsüan's Blog

2015-07-20

取消 apache 回應 header 自帶的訊息

步驟

  • Server:Apache/2.2.22 (Debian) 減少成 Server:Apache 修改 apache.conf (debian 預設路徑在 /etc/apache2/apache2.conf),新增

    # 取消原本apache回應的錯誤訊息會帶版本訊息
    ServerTokens ProductOnly
    ServerSignature Off
  • 取消 apache 回應的 X-Powered-By: PHP/5.3.7 修改 php.ini (debian 預設在 /etc/php5/apache2/php.ini, /etc/php5/cli/php.ini)

    expose_php = Off
  • 加層保險在 .htaccess

    <IfModule mod_headers.c>
      Header unset Server
      Header unset X-Powered-By
    </IfModule>

© 2019 ~ 2025 Hsüan, Powered by Gatsby, Theme Material UI