Nginx-隐藏版本号

配置文件隐藏版本号

Syntax:    server_tokens on | off | build | string;
Default:    
server_tokens on;
Context:    http, server, location

编译安装隐藏版本号

]# vim ~/nginx-1.16.1/src/core/nginx.h
/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#ifndef _NGINX_H_INCLUDED_
#define _NGINX_H_INCLUDED_


#define nginx_version      1016001
#define NGINX_VERSION      "1.0"  //版本号
#define NGINX_VER          "nicai/" NGINX_VERSION   //服务器名称

#ifdef NGX_BUILD
#define NGINX_VER_BUILD    NGINX_VER " (" NGX_BUILD ")"
#else
#define NGINX_VER_BUILD    NGINX_VER
#endif

#define NGINX_VAR          "NGINX"
#define NGX_OLDPID_EXT     ".oldbin"


#endif /* _NGINX_H_INCLUDED_ */

重新编译后测试

]# curl http://www.magedu.net/about/index1 -i
HTTP/1.1 200 OK
Server: nicai/1.0
Date: Sun, 09 Jan 2022 13:16:16 GMT
Content-Type: text/html
Content-Length: 10
Last-Modified: Sun, 09 Jan 2022 09:55:02 GMT
Connection: keep-alive
Keep-Alive: timeout=60
ETag: "61dab0f6-a"
Accept-Ranges: bytes

index1 v3

 

上一篇:创建SpringBoot的Project,出现Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.5.2问题


下一篇:约瑟夫斯问题-java版数组解法和链表解法