brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: server_tokens off hides the nginx version from headers and error pages

Nginx
~/tips/tip-nginx-server-tokens-off

server_tokens off;

Removes the nginx version number from the Server header and error pages.

The version number in every response is free information for anyone scanning for known bugs.

server_tokens off;

curl -sI https://example.com | grep -i '^server'

By default nginx puts nginx/1.24.0 into the Server header and at the bottom of its error pages. With server_tokens off only nginx remains. This is a small reduction in fingerprinting and no replacement for updates. Removing the header entirely needs the third-party headers-more module. Put the directive in the http block so it covers every server, and repeat the curl check after a reload to see the shorter header. The version also disappears from the default 404 page.

Further reading: ngx_http_core_module: server_tokens

Going deeper: ๐Ÿ›œ Guide: AdGuard Home + Tailscale (Secure Split-Horizon DNS)

More Nginx tips sudo certbot --nginx -d example.com -d www.example.com /data/nginx/custom/server_redirect.conf map $http_upgrade $connection_upgrade { proxy_intercept_errors on; proxy_redirect http://localhost:3000/ /app/; All Nginx tips (50) All topics

Link