Home  >  Article  >  Operation and Maintenance  >  How to modify the Nginx version name to disguise any web server

How to modify the Nginx version name to disguise any web server

WBOY
WBOYforward
2023-05-14 21:19:121089browse

How to modify the default name of nginx, you can disguise it a little, or you can install There is a ngx_http_special_response.c.

Tips: Generally, modifications are made before nginx is compiled. After modification, you need to recompile

The code is as follows:

scr/core/nginx .conf

#define nginx_version "1.4.7"

#define nginx_ver "nginx/" nginx_version



is modified to: (In fact, the version number can also be modified at will)

The code is as follows:

#define nginx_version "1.4.7"

#define nginx_ver "jdws/" nginx_version


In fact, modifying most of the above will take effect ! ! !

The code is as follows:

/src/http/ngx_http_header_filter_module.c (http responseheader)

static char ngx_http_server_string[] = "server: nginx" crlf;


Modify to:

static char ngx_http_server_string[] = "server: jdws" crlf;

/src/http/ngx_http_special_response.c

static u_char ngx_http_error_tail[] =

"


nginx
" crlf
"" crlf
"" crlf


changed to:

static u_char ngx_http_error_tail[] =

"


jdws
" crlf

"" crlf

" " crlf


In addition to modifying the version number at will, you can also hide the version number:

Modify nginx.conf

in http{ } Add the

code as follows:

http{

server_tokens off;

}



to hide the version number.

Note:

After turning off server_tokens, the nginx.conf configuration will be invalid. Go back and look for the configuration in our second and third steps

Unhidden version number:

Hidden version number: 怎么修改Nginx版本名称伪装任意web server

The above is the detailed content of How to modify the Nginx version name to disguise any web server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete