Secure Apache and PHP, hide version numbers

Written by
Date: 2011-07-21 10:36:30 00:00


You may be concerned about security on your LAMP server, and you should hackers are always trying to break into your or anyone’s else system.

After finding this in slashdot, I have decided to show you how to to stop Apache and PHP sending their versions and other valuable info for hackers.

Hide Apache version

To make Apache stop sending its version number to any visitor do as follow:

Edit the file http.conf or apache2.conf and add the following lines.

ServerSignature Off
ServerTokens Prod

Restart Apache

Hide PHP version

Now the turn of PHP, we do not want those hackers out there to know which version of PHP we are running rig?

Edit the file php.ini, usually in /etc/php/ or /etc/php/apache2/` and add or change the following lines:

expose_php = Off
display_errors = Off

Restart Apache server.

You are done, now, your system is a little bit more secure. Remember that everybody have access to your server.