ASAIK,我们需要安装第 3 方模块(例如 more_clear_headers)并在 nginx.conf 中添加配置以完全删除服务器头。
load_module modules/ngx_http_headers_more_filter_module.so;
http {
...
more_clear_headers Server;
...
}
但是,在 AMI 中,如何做到这一点?
使用这个命令没有包: $ yum install more_clear_headers
答案 0 :(得分:-1)
只有商业解决方案可以从包中安装。您可以使用 NGINX Plus(昂贵的),也可以使用更便宜的支持 Amazon Linux 2 的 GetPageSpeed 存储库。
按照 the article 从 GetPageSpeed 存储库设置模块:
sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
sudo yum -y install nginx-module-headers-more
现在您可以像这样调整您的 nginx.conf
:
load_module modules/ngx_http_headers_more_filter_module.so;
http {
...
more_clear_headers Server;
...
}