Nginx隐藏标识以及其版本号

1、隐藏版本号

curl Nginx服务器时,有这么一行Server: nginx,说明我用的是 Nginx 服务器,但并没有具体的版本号。由于某些 Nginx 漏洞只存在于特定的版本,隐藏版本号可以提高安全性。这只需要在nginx.conf配置里加上这个就可以了:

server_tokens off;

2、隐藏Nginx标识--修改源码

# vim src/core/nginx.h +14

#define NGINX_VER          "wjoyxt/" NGINX_VERSION

# vim src/http/ngx_http_special_response.c  +29

"<hr><center>wjoyxt</center>" CRLF

# vim src/http/ngx_http_header_filter_module.c +49

static char ngx_http_server_string[] = "Server: wjoyxt" CRLF;

3、重新编译安装后即可

4、curl -I 进行验证

扫描二维码关注公众号,回复: 2391006 查看本文章

猜你喜欢

转载自www.cnblogs.com/wjoyxt/p/9373646.html