NGINXUbuntu

Hide Server Info Response on NGINX

Hiding server info response on NGINX

How to hide Server: Response info on NGINX

$ curl -I localhost
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 11 Aug 2017 14:09:04 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 04 Mar 2014 11:46:45 GMT
Connection: keep-alive
ETag: "5315bd25-264"
Accept-Ranges: bytes

To hide Server: on HTTP Response, you need install nginx-extras instead nginx/nginx-core

Install nginx-extras on Ubuntu

apt-get install nginx-extras

add these line on http {}

vim /etc/nginx/nginx.conf

http {
  server_tokens off;
  more_clear_headers Server;
}

Reload/restart NGINX


nginx -s reload

Test / check the result
you will see Server: nginx/1.4.6 (Ubuntu) is gone.

$ curl -I localhost
HTTP/1.1 200 OK
Date: Sat, 12 Aug 2017 05:01:13 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 04 Mar 2014 11:46:45 GMT
Connection: keep-alive
ETag: "5315bd25-264"
Accept-Ranges: bytes

You might be interested in exploring more about web server technologies. Speaking of NGINX, you might find it helpful to read about NGINX, an open-source web server known for its high performance and stability. If you’re curious about server security practices, check out Web Server Security, which covers essential measures to protect your server. Additionally, learning about HTTP Response Headers can give you insights into how headers work and their role in web communications. These resources can enhance your understanding of server management and security.

Hi, I’m Sysadmin.ID

Leave a Reply

Your email address will not be published. Required fields are marked *