Remove server info from Apache mod_autoindex and error page footers

How to remove server info at the bottom of the directory listing?

It looks like this: Apache/2.2.14 (Ubuntu) Server


Solution 1:

Add ServerSignature Off line inside either the .htaccess, the virtual host file, or the main config file.

More info can be found in the official apache documentation.

Solution 2:

Add ServerSignature Off to your main Apache config file.

Also search for ServerSignature On in your whole apache config folder:

cd /etc/apache2
grep -R 'ServerSignature On' * | grep -v '#'

and change all findings with ServerSignature Off

Also search in your web folder for such setting in all .htaccess files:

find /var/www/ -name ".htaccess" -print | xargs grep "ServerSignature On"|grep -v '#'

If those findings are too many, you can use sed to replace in the resulting output ServerSignature On with ServerSignature Off