Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache: how to hide server version and operation system from users?

Tags:

I've read on one site that I need to add two lines to httpd.conf file:

ServerSignature Off

ServerTokens Prod

But when I've added them nothing changed. As previously I can see in my browser

Apache/2.2.16 (Debian)

Maybe that's important: When I opened file (I mean before adding above lines) httpd.conf I saw it's empty. I use VPS.

Thanks!

like image 402
Vitalii Ponomar Avatar asked Jan 25 '12 10:01

Vitalii Ponomar


People also ask

What is Apache ServerTokens?

Server Identification The ServerTokens directive sets the value of the Server HTTP response header field. The ServerName , UseCanonicalName and UseCanonicalPhysicalPort directives are used by the server to determine how to construct self-referential URLs.


2 Answers

Simple:

sudo nano /etc/apache2/conf-enabled/security.conf

Then:

  • change ServerTokens OS to ServerTokens Prod
  • change ServerSignature On to ServerSignature Off

Restart Apache :

sudo service apache2 restart

This article may also help you: Hide Apache Information

like image 191
Shanu T Thankachan Avatar answered Oct 02 '22 21:10

Shanu T Thankachan


you didnt give enough information about os/distribution etc

but in ubuntu's apache installation apache2.conf looks like this:

<cut>
Include httpd.conf
Include ports.conf
Include conf.d/
Include sites-enabled/

and in conf.d/security you can see

ServerTokens OS

just check your configs, somewhere it gets overwritten after you set it in your httpd.conf

like image 41
jackdoe Avatar answered Oct 02 '22 21:10

jackdoe