hide_server_tokens
The `hide_server_tokens` directive suppresses the display of the `Server` response header in NGINX to enhance security.
Description
The hide_server_tokens directive is used to prevent NGINX from disclosing its version information in the Server HTTP response header. By default, NGINX includes a header indicating its version and the OS it's running on, which can potentially reveal vulnerabilities to attackers. When hide_server_tokens is set to on, this information is hidden, and the Server header either becomes empty or is not sent at all, helping to obscure the software stack of the server from malicious actors. This directive is particularly important in environments where security is critical, as it reduces the surface area for attacks based on known vulnerabilities of specific server versions.
This directive can be set in various contexts, such as http, server, or location, allowing for flexible configuration based on the needs of web applications. Administrators can easily include or exclude this behavior at different levels of their server configuration, helping in securing specific locations or the entire server. Overall, the use of hide_server_tokens is a best practice for enhancing the security posture of an NGINX server deployment.
Config Example
http {
hide_server_tokens on;
}Ensure that the security_headers module is enabled in your NGINX configuration so that the Server header can be hidden effectively.
If using other modules that modify headers, verify their interactions with hide_server_tokens to prevent conflicts.