码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx隐藏标识以及其版本号

时间:2018-07-26 20:02:06      阅读:685      评论:0      收藏:0      [点我收藏+]

标签:static   spec   源码   token   color   版本   string   div   define   

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 进行验证

 

Nginx隐藏标识以及其版本号

标签:static   spec   源码   token   color   版本   string   div   define   

原文地址:https://www.cnblogs.com/wjoyxt/p/9373646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!