The nginx Server response header may show the server’s version. You can suppress the version with server_tokens off, while keeping the software updated to address actual vulnerabilities.
Check the response header
Replace example.com with the actual site:
curl -I https://example.com/Inspect the Server header. A reverse proxy or CDN may supply its own header, and a redirect response may come from a different server than the final page.
Hide the nginx version
You need administrator access to the nginx configuration. On a control-panel server, use the panel’s supported custom-configuration method to avoid changes being overwritten.
- Keep a copy of the current configuration.
- In the applicable
http,serverorlocationcontext, add or change:
server_tokens off;- Test the configuration:
sudo nginx -t- Only if the test succeeds, reload nginx. On a systemd installation:
sudo systemctl reload nginx- Repeat the header check and test the site. Check for an overriding directive or an upstream proxy if the result differs.
This normally leaves Server: nginx while removing the version. It does not remove every identifying header or provide protection against unpatched software.