如何修改或者隐藏Nginx版本信息实现服务器响应头信息混淆

如何修改或隐藏Nginx服务器名称和版本号?我们需要在编译Nginx之前修改源码文件nginx.h,nginx.h文件位于src/core/目录下 。具体操作如下

原文件内容:

#define nginx_version      1008001
#define NGINX_VERSION      "1.8.1"
#define NGINX_VER          "nginx/" NGINX_VERSION

#define TENGINE            "Tengine"
#define tengine_version    2002002
#define TENGINE_VERSION    "2.2.2"
#define TENGINE_VER        TENGINE "/" TENGINE_VERSION

修改后内容:

#define nginx_version      1008001
#define NGINX_VERSION      "1.0.0"
#define NGINX_VER          "example.com/" NGINX_VERSION

#define TENGINE            "example.com"
#define tengine_version    2002002
#define TENGINE_VERSION    "1.0.0"
#define TENGINE_VER        TENGINE "/" TENGINE_VERSION

the end

热门文章