Now Chatting

Hello, can I help you with anything?


In default Apache configuration, the server sends HTTP Header with the information of Apache version, modules, Operating System, etc of the Server. The HTTP response header “Server” displays all these details of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Apache, OS or other modules you are running, specially if you are running an older version with known vulnerabilities.

solution is to hide this kind of information.
To do that you have to use the Apache Header Directive. Basically this Header Directive is processed just before the response is sent back to the network, so it allows you to overwrite/modify the response header set by your application.

Load Apache Headers Module.
First, make sure you have header module installed, use the following command to see all the loaded modules:
httpd -M
Check headers_module is in the list. If header module is not loaded, you have to load it in the httpd config.
Locate your httpd config files. If you are not sure where is your config files, run the following command to show the compile settings:
httpd -V
It should show HTTPD_ROOT as well as SERVER_CONFIG_FILE. In my case, the following is the output for this two settings:
-D HTTPD_ROOT=”/usr/local/httpd”
-D SERVER_CONFIG_FILE=”conf/httpd.conf”
From here, you knows that your httpd.conf location is /usr/local/httpd/conf/httpd.conf. After you locate httpd.conf, edit this file and add the following line to load the header module
LoadModule headers_module modules/
Now, do httpd -M again, you should see the loaded modules include headers_module.
After headers_module is loaded, include the following lines of config in the httpd.conf, if the settings are there, make sure it is the correct value.
ServerSignature Off
ServerTokens Prod
Normally apache would display a trailing footer line, which includes information like server name, version etc, under server generated documents, e.g. error message etc. So ServerSignature Off would turn this off. So it won’t include this trailing footer line. ServerTokens Prod will only return “Apache” in the Server header without any version number. For details explanation, refer to this apache documentation.

Further more, we should totally unset the Server header and X-Powered-By header, so include the following lines in the httpd.conf as well.
view plaincopy to clipboardprint?
# If mod_headers module is included, we will disable the Server response header totally

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

With the above changes, you should have already unset or removed those apache response headers that expose important security informations.