2020 Update:
To build on the answer by @Maxym on using the mod_security
module - NOTE that you CANNOT remove the server header ENTIRELY ( that is only possible through source code editing/recompilation ) with this module, however you can rename the public server signature - say "NinjaServer" via this
mod_security
module !
To do that;
We have to ( in httpd.conf or equivalent ) keep/set;
ServerTokens Full
Then via mod_security2.conf;
SecServerSignature "NinjaServer"
Also, its better for the mod_security module to be loaded last to avoid notices in the apache error log.
For a OpenSuse 15.x / Apache 2.4.x Setup, the actual steps are;
zypper -v in apache2-mod_security2 // install mod_security
a2enmod security2 // enable the module
a2enmod unique_id // this was needed too...
a2enmod -l // verify loaded
Next, edit httpd.conf.local (under /etc/apache2) and set;
ServerTokens Full
Next, edit mod_security2.conf (under /etc/apache2) and set;
SecRuleEngine DetectionOnly // only remove apache server name
SecServerSignature "NinjaServer" // some name other than Apache
Also comment out ( this example is just for modifying Public Server Signature );
# Include /usr/share/apache2-mod_security2/rules/modsecurity_crs_10_setup.conf
Then restart apache via
systemctl restart apache2
And if you were to check your headers ( Browser's Dev Tools ) now, you will see the
Server name appearing as NinjaServer :-)