如果我们想隐藏apache的版本信息,或者隐藏apache的敏感信息需要我们在编译之前对以下文件进行修改:(我们以apache的2.2.27版本为列)
vim /usr/local/tools/httpd-2.2.27/include/ap_release.h
#define AP_SERVER_BASEPRODUCT "Apache" 改成 Microsoft-IIS
下面标红的是指的apache的版本信息,我们可以做相对应的修改
#define AP_SERVER_MAJORVERSION_NUMBER 2 7
#define AP_SERVER_MINORVERSION_NUMBER 2 0
#define AP_SERVER_PATCHLEVEL_NUMBER 27 0
#define AP_SERVER_DEVBUILD_BOOLEAN 0 0
vim /usr/local/tools/httpd-2.2.27/os/unix/os.h
35 #define PLATFORM "Unix" 改成 Win32
修改完成后再编译安装查看就可以了!
安装好后进行查看:
[[email protected] httpd-2.2.27]# curl -I 127.0.0.1
HTTP/1.1 200 OK
Date: Fri, 02 Jun 2017 13:15:52 GMT
Server: Microsoft-IIS/7.0.0 (Win32) DAV/2
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
ETag: "8050a-2c-3e9564c23b600"
Accept-Ranges: bytes
Content-Length: 44
Content-Type: text/html