欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

nginx隱藏server及版本號(hào)的實(shí)現(xiàn)

 更新時(shí)間:2024年08月08日 10:12:28   作者:???????long_2145  
為了提高nginx服務(wù)器的安全性,降低被攻擊的風(fēng)險(xiǎn),需要隱藏nginx的server和版本號(hào),本文就來介紹一下nginx如何隱藏server及版本號(hào),具有一定的參考價(jià)值,感興趣的可以了解一下

1、背景

為了提高nginx服務(wù)器的安全性,降低被攻擊的風(fēng)險(xiǎn),需要隱藏nginx的server和版本號(hào)。

2、隱藏nginx版本號(hào)

在 http {—}里加上  server_tokens off; 如:
http {
    ……省略
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 60;
    tcp_nodelay on;
    server_tokens off;
    …….省略
}

3、隱藏server信息

修改源碼文件,從新編譯

# vim /path/nginx/src/http/ngx_http_header_filter_module.c 
修改前
 49 static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
 50 static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
 51 static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;
修改后
 49 static u_char ngx_http_server_string[] = "Server: " CRLF;
 50 static u_char ngx_http_server_full_string[] = "Server: "  CRLF;
 51 static u_char ngx_http_server_build_string[] = "Server: "  CRLF;

4、隱藏 nginx -V 的版本號(hào)

修改源碼文件,從新編譯

# vim /path/nginx/src/core/nginx.c
修改前
 390 static void
 391 ngx_show_version_info(void)
 392 {
 393     ngx_write_stderr("nginx version: " NGINX_VER_BUILD NGX_LINEFEED);
 394
 395     if (ngx_show_help) {

修改后
 390 static void
 391 ngx_show_version_info(void)
 392 {
 393     ngx_write_stderr("nginx version: " "hello world\n");
 394
 395     if (ngx_show_help) {

到此這篇關(guān)于nginx隱藏server及版本號(hào)的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)nginx隱藏server及版本號(hào)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論