首頁 > 運維 > Nginx > 主體

怎麼修改Nginx版本名稱偽裝任意web server

WBOY
發布: 2023-05-14 21:19:12
轉載
1088 人瀏覽過

如何修改nginx預設的名稱,可以稍微的偽裝一下,也可以裝x

一般來說修改3個位置,一個是nginx.h、另一個是ngx_http_header_filter_module.c、還有一個ngx_http_special_response.c。

提示:一般修改都是在nginx編譯之前修改,修改完了之後需要重新編譯

程式碼如下:

##scr/core/nginx .conf

#define nginx_version "1.4.7"

define nginx_version "1.4.7"
#define nginx_ver "nginx/" nginx_version

##修改為:(其實版本號碼也可以隨意修改)

程式碼如下:

#define nginx_version "1.4.7"
#define nginx_ver "jdws/" nginx_version

#其實修改上面大部分就會生效! ! !

程式碼如下:

/src/http/ngx_http_header_filter_module.c (http responseheader)
static char ngx_http_server_string[] = "server: nginx" crlf;

#修改為:

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

修改為:

#static u_char ngx_http_error_tail[] =
"


jdws
" crlf
"" crlf
" " crlf

除了隨意修改版本號之外,還可以隱藏版本號:

#修改nginx.conf

##在http{ }加入


程式碼如下:

##http{

server_tokens off;

}


就可以隱藏版本號碼了。


注意:


關掉了server_tokens之後,nginx.conf配置的東西會無效,回去尋找剛才我們第二步和第三步的設定


未隱藏版本號碼:

怎么修改Nginx版本名称伪装任意web server隱藏版本號碼:

以上是怎麼修改Nginx版本名稱偽裝任意web server的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:yisu.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!