midea2 发表于 2018-11-13 10:56:37

nginx安全

  1.隐藏版本号和server信息
  # vim src/core/nginx.h
  #define NGINX_VERSION       ""
  #define NGINX_VER          "tingyun/" NGINX_VERSION
  #define NGINX_VAR          "tingyun"
  # vim src/http/ngx_http_header_filter_module.c
  static char ngx_http_server_string[] = "" CRLF;
  static char ngx_http_server_full_string[] = "" NGINX_VER CRLF;
  # vim src/http/ngx_http_special_response.c
  "tingyun" CRLF
  # ./configure--prefix=/usr/local/nginx-1.8.0--with-file-aio--with-poll_module--with-pcre--without-http_autoindex_module--without-http_ssi_module--without-mail_pop3_module--without-mail_smtp_module--without-mail_imap_module
  # make && make install
  2.下载安装modsecurity安全模块
  # yum install libtool httpd-devel libevent libevent-devel library-devel -y
  # tar xvf ModSecurity-2.9.0.tar.gz
  # ./configure --enable-standalone-module --disable-mlogc
  # make
  # ./configure--prefix=/usr/local/nginx-1.8.0--with-file-aio--with-poll_module--with-pcre--without-http_autoindex_module--without-http_ssi_module--without-mail_pop3_module--without-mail_smtp_module--without-mail_imap_module --add-module=/root/ModSecurity-2.9.0/nginx/modsecurity/
  # make && make install

页: [1]
查看完整版本: nginx安全