In default Apache write server signatures to HTTP-responses. In production server this is not recommended action, because it gives more attacking area to criminals. Web servers would like to advice themselves and that is the reason why they add their signatures in default to HTTP-responses.

In this post I will show you how to hide unnecessary Apache server signature.

Tested on Ubuntu 14.04 and Ubuntu 12.04.

At beginning

you can watch how your server HTTP-response looks like now. Do HTTP-request e.g. with curl:

$ curl -I

There is your HTTP-header and now you see exactly what all informations Apache gives to client. We still want to limit information of our server from outside.

Hide Apache signatures

At first open Apache configuration file apache2.conf

$ sudoedit /etc/apache2/apache2.conf

Add two lines on below to apache2.conf

ServerTokens Prod
ServerSignature Off

Save file and reload Apache daemon

$ sudo service apache2 reload

Hide also information of PHP

If you are using PHP HTTP-header also contain some information of PHP. Here is the way how to hide it.

Open php.ini

$ sudoedit /etc/php5/apache2/php.ini

In default expose_php is set to On, but now you take it Off

; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header).  It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
expose_php = Off

After changes you have to reload Apache

$ sudo service apache2 reload

Now you’re a little further safe.