Remove Server Headers in Apache and Nginx

As you install web server, in default it provides it’s name and version to the clients. It is an information leakage and it will help attackers to narrow down their attacks. Attackers searches the known vulnerabilities in the exploit databases and launch precise attacks on the server.

To find whether your web server is also leaking the same information
curl [target] -I

HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Fri, 29 Dec 2017 04:37:43 GMT
Content-Type: text/html
Content-Length: 1077
Last-Modified: Tue, 26 Dec 2017 11:13:35 GMT
Connection: keep-alive
ETag: “5a422edf-435”
Accept-Ranges: bytes

Apache and httpd

For Apache, edit your apache2.conf file. In default, the file will be at /etc/apache2/apache2.conf.

For httpd, edit your httpd.conf file. In default, the file will be at /etc/httpd/httpd.conf.

Append the lines below in the bottom of the file.

Header unset Server
ServerSignature Off
ServerTokens Prod

Nginx

sudo apt-get -y update
sudo apt-get install nginx-extras

Edit your nginx.conf file. In default, the file will be at /etc/nginx/nginx.conf. Find and uncomment the line.

#server_tokens off;

Below the line, add following.

more_clear_headers Server;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s