在Alpine Linux下编辑/隐藏Nginx Server标头 [英] Edit / hide Nginx Server header under Alpine Linux
问题描述
当我使用curl --head
测试我的网站时,它将返回服务器信息.
When I use curl --head
to test my website, it returns the server information.
我遵循了此教程以隐藏Nginx服务器头.
但是当我运行命令yum install nginx-module-security-headers
,它返回yum: not found
.
I followed this tutorial to hide the nginx server header.
But when I run the command yum install nginx-module-security-headers
, it returns yum: not found
.
我也尝试过apk add nginx-module-security-headers
,它表明缺少包裹.
I also tried apk add nginx-module-security-headers
, and it shows that the package is missing.
我已将nginx:1.17.6-alpine
用作我的基本docker映像.有谁知道如何在此Alpine下的标头中隐藏服务器?
I have used nginx:1.17.6-alpine
as my base docker image. Does anyone know how to hide the server from header under this Alpine?
推荐答案
我找到了替代解决方案.它显示二进制不兼容的原因是因为我在目标路由下预装了一个Nginx,并且它与我正在使用的header-more模块不兼容.这意味着我不能简单地从Alpine软件包中安装第三方库.
I found the alternate solution. The reason that it shows binary not compatible is because I have one nginx pre-installed under the target route, and it is not compatible with the header-more module I am using. That means I cannot simply install the third party library from Alpine package.
因此,我准备一个干净的Alpine操作系统,并遵循 GitHub存储库使用其他功能从源代码构建Nginx.构建结果的路径是您指定的前缀路径.
So I prepare a clean Alpine OS, and follow the GitHub repository to build Nginx from the source with additional feature. The path of build result is the prefix path you specified.
这篇关于在Alpine Linux下编辑/隐藏Nginx Server标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!