How to change Apache’s Server:
header without mod_security?
I do not want to use mod_security because I don’t have anything else to do with it. And it is a useless overhead for me.
Instead, what should I change in the Apache’s source? I usually use Apache compiled from source.
I am using Apache version 2.4.46.
2
Answers
To change Apache's
Server:
header, change the following in the source code:Change the file
/path/to/httpd-2.4.46/include/ap_release.h
:Go to the line like:
And change it to anything, like:
And then compile apache, and you are good!
Also, make sure to follow the license that is provided with it. Questions about license here are off-topic.
I understand not using
mod_security
to change a single header so you may want to give https://github.com/bostrt/mod_serverheader#installation a try. It’s under 100 lines of code and runs one hook at startup of Apache HTTPD so very low overhead.mod_serverheader
provides a single directive that lets you completely overwrite the Server header, for example:Then, when someone accesses your website they will see: