1.自定义server信息
修改nginx解压目录下的/src/core/nginx.h文件
修改nginx解压目录下的/src/http/ngx_http_header_filter_module.c文件
修改 nginx解压目录下的/src/http/ngx_http_special_response.c文件
全部修改完成后,执行./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module
随后执行make,切记不要执行make && make install
将原有nginx/sbin/nginx备份
将刚刚make后的(nginx解压目录的objs目录下)的nginx覆盖到原nginx
cp objs/nginx /usr/local/nginx/sbin/nginx
重启nginx,查看响应头,server已经变成了我们改动的:caiyicai
2.隐藏版本号:
修改nginx.conf文件,在server中添加 server_tokens off;即可