Linux Tutorials, Guides & Latest Tech Stuffs

How to hide Nginx server version

Nginx is one of the most widely used web servers. It is a very light and high-performance HTTP server and proxy server. Nginx uses async even driven approach for handling requests, it’s modular architecture can provide more predictable performance under high loads. Showing web server version in headers weakens your security and it can reveal vulnerability associated with this Nginx Version.

How to hide Nginx version

We assume that you have installed Nginx on your Ubuntu Server. For hiding Nginx version, you need to edit nginx configuration nginx.conf  located /etc/nginx/nginx.conf or /usr/local/nginx/conf/nginx.conf

Open configuration file with editor like vim or nano 

vim nginx.conf

Turn off Server token variable

server_tokens variables is used to control version in Nginx, Just turn it off as shown below. You need to add server_tokens off; in your nginx.conf file and save it  ( I have highlighted this line, check image below )

server_tokens off;

Restart Nginx Server

service nginx restart

Check if nginx version is removed

You can use curl command to see server headers and if nginx version is not appeared, it means you have successfully removed Nginx version from your Nginx Server.

curl -I example.com

Add your own site at the place of example.com and run curl command. After running curl command you should get following output.

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 05 Apr 2018 07:00:25 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive

Related Search Terms

hide nginx version

remove nginx version

remove nginx version header

nginx remove server tokens

Pranav K

Pranav K is a software engineer and all-round computer geek. His interests include AWS, Ubuntu and Wordpress

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.