How to Remove NGINX Server Header in Ubuntu 18.04

So, how can I remove the server info in the response header in Ubuntu 18.04 Linux?

#1 Install nginx-extras by running command below:

sudo apt install nginx-extras

#2 Once installation finish, you can update your server block in Nginx configuration by adding one line below to remove server info from the response header:

more_clear_headers Server;

#3 You may also set the server response to anything else, i.e. set to Google Web Server (gws) just to confuse people (optional).

more_set_headers 'Server: gws';

#4 Finally, retest your Nginx configuration and reload it if no error found.

sudo nginx -t
sudo systemctl reload nginx

That’s all. You can read more about the nginx-extras header more module here: Bionic

Let me know in the comment below if you got any errors or should I add more stuff in this tutorial; How to Remove Nginx Server Header in Ubuntu 18.04.