修改or隱藏nginx版本號

2021-10-06 12:00:00 字數 2041 閱讀 9657

參考:

nginx隱藏版本號操作

如何更改nginx的原始碼以及版本號

檢視nginx版本號的幾種方法

nginx預設顯示版

本號,但這樣人家能看到你的伺服器nginx的真實版本號,而這個暴露出的版本號很易變成攻擊者可利用的資訊。所以,從安全的角度來說,

隱藏版本號會相對安全些!

1、在nginx.conf配置檔案中的http模組中國新增「 server_tokens off;」

2、編輯配置檔案fastcgi.conf 和 fastcgi_params 此法嘗試沒成功

修改內容:http {

結果curl查不到nginx的版本號,postman請求看不到nginx版本號,但使用nginx -v依舊可以查到[root@syslo**m nginx]# curl -i 127.0.0.1

server: nginx      #nginx版本號被隱藏了

date: thu, 20 feb 2020 02:19:35 gmt

content-type: text/html

[root@syslo**m nginx]# nginx -v

nginx version:

nginx/1.16.1

修改內容:fastcgi_param  server_software 

nginx/$nginx_version

;

結果

:沒生效

修改nginx版本號對原始碼進行修改,原始碼檔案都在二級目錄「nginx-0.8.53/src/」下,找到如下檔案「src/core/nginx.h」,然後再對它進行修改。

1、修改第乙個檔案src/core/nginx.h

[root@mail nginx-0.8.53]# vi

src/core/nginx.h

2、修改第二個檔案/src/http/ngx_http_header_filter_module.c,將末尾的nginx修改為ows

3、修改第三個檔案/src/http/ngx_http_special_response.c

4、檢查語法重新啟動

nginx 版本號隱藏

nginx的版本號預設是開啟的,可以在預設的錯誤頁面和http響應頭中檢視到。比如的http響應頭資訊 有些時候http 1.1 200 ok server nginx 1.2.3 date fri,14 dec 2012 05 39 29 gmt content type text html ch...

nginx隱藏版本號

1.隱藏版本號 vi nginx.conf http2.隱藏nginx軟體名及版本號 第一步 修改nginx的原始碼檔案 需要在安裝之前修改 vi src core nginx.h define nginx version 1.10.0 define nginx ver nginx nginx ve...

nginx 隱藏nginx版本號

為什麼要隱藏 nginx 版本號 一般來說,軟體的漏洞都與版本有關,隱藏版本號是為了防止惡意使用者利用軟體漏洞進行攻擊 server tokens off 隱藏版本號 server listen 80 server name www.abc.com location root html www in...