I can hide Nginx version by using server_tokens option set to off. But not able to change the Nginx Server signature.
Steps I did,
1.) Change the Nginx server name in source file(src/http/ngx_http_header_filter_module.c) to " My-Server". After that, compiled the nginx. But its not working when I load the url. Strange here is I can see my updated Signature when I use curl command. But this same is not updated in browser.
2.) So I tried 3rd party module(headers-more-nginx-module). This too not working. Getting updated name via Curl. But not in Browser.
The “server_tokens” directive is responsible for displaying the Nginx version number and Operating system on error pages and in the “Server” HTTP response header field as shown in the following screenshot. Nginx Version Number. To disable this, you need to turn off the server_tokens directive in /etc/nginx/nginx.
Open up a terminal window and issue the command sudo nano /etc/apache2/conf-enabled/security. conf. Within that file, search for SeverTokens and set it to Prod, then search for ServerSignature and set it to Off (Figure A).
After that, all new processes can be shut down gracefully, by sending the QUIT signal to the new master process. Send the TERM signal to the new master process. It will then send a message to its worker processes requesting them to exit immediately, and they will all exit almost immediately.
If you are working in ubuntu then
First install nginx-extras
sudo apt-get install nginx-extras
Go to /etc/nginx/nginx.conf
and under http
add:
http { more_set_headers "Server: Your_New_Server_Name"; server_tokens off; }
Restart nginx
sudo service nginx restart
Go to nginx conf and switch off server_tokens.
/etc/nginx/nginx.conf server_tokens off;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With