Nginx 优化

1. 介绍

       根源上修改nginx版本号。这个比较彻底,一般是安装之前就修改源码,如安装过的,就要修改源码重新编译。一般修改三个地方:

  • 修改src/core/nginx.h(Nginx内部名称的)

#define NGINX_VERSION      "1.12.0"
#define NGINX_VER          "nginx/" NGINX_VERSION
- 修改src/http/ngx_http_header_filter_module.c(HTTP ResponseHeader)

static u_char ngx_http_server_string[] = "Server: nginx" CRLF
  • 修改src/http/ngx_http_special_response.c(修改错误页的底部Footer)
static u_char ngx_http_error_tail[] = 下的nginx信息