Nginx – hide server version and name in Server header and error pages

On Debian you have to install nginx-extras package (because it have built in headers_more module). Then you need two options (best in global configuration /etc/nginx/nginx.conf file, http part):

server_tokens off;
more_set_headers 'Server: BadAss';

And it’s good to setup non standard error pages on every site (500 and 404 at minimum):

error_page   403 404       http://mysite.com/areyoulost;
error_page   502 503 504   /500.html;

One thought on “Nginx – hide server version and name in Server header and error pages”

Leave a Reply

Your email address will not be published. Required fields are marked *