ASAIK, we need to install 3rd party modules (e.g more_clear_headers) and add configure in nginx.conf to remove the server header completely.
load_module modules/ngx_http_headers_more_filter_module.so;
http {
...
more_clear_headers Server;
...
}
However, in AMI, how to do that?
There is no package by using this command:
$ yum install more_clear_headers
2
Answers
There are only commercial solutions available to install from packages. You can either use NGINX Plus (expensive), or a cheaper GetPageSpeed repository that supports Amazon Linux 2.
Follow through the article to set up the module from GetPageSpeed repo:
Now you can adjust your
nginx.conf
like this:Remove at least the version number with
The
Server
response header will behttp://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens