Nginx安装之前修改源码内容,让网站伪装为运行软件为Tengine:
可以随意修改为自己想要名称
wget http://nginx.org/download/nginx-1.14.2.tar.gz
tar zxvf nginx-1.14.2.tar.gz
cd nginx-1.14.2
sed -i s#"nginx/"#"Tengine/"#g src/core/nginx.h
sed -i s#"Server: nginx"#"Server: Tengine"#g src/http/ngx_http_header_filter_module.c
sed -i s#center\>nginx#center\>Tengine#g src/http/ngx_http_special_response.c
安装完Nginx以后修改配置文件在http段增加 server_tokens off; 重启nginx
因为没修改版本号、所以把版本号隐藏
操作详细步骤:
[root@localhost nginx-1.14.2]# vim src/core/nginx.h 13-14行左右
[root@localhost nginx-1.14.2]# vim src/http/ngx_http_header_filter_module.c 49行左右
[root@localhost nginx-1.14.2]# vim src/http/ngx_http_special_response.c 22-36行左右
或者只修改36行业可以,把备注(lin_yao_hong)和36行内容放到一起