打赏

星辰大海ゞ

That which does not kill us makes us stronger!

导航

Nginx隐藏标识以及其版本号

1、隐藏版本号

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

server_tokens off;

 

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

下载Nginx源码  http://nginx.org/download/

# vim src/core/nginx.h +14

#define NGINX_VER          "wjoyxt/" NGINX_VERSION

# vim src/http/ngx_http_special_response.c  +22 +29 和 +36  (注意修改后无引号,NGINX_VER为变量)

"<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 验证版本号

5、访问一个不存在的页面验证标识

 

posted on 2018-07-26 18:48  星辰大海ゞ  阅读(833)  评论(0编辑  收藏  举报