Nginx的版本號隱藏 Masuri

2022-09-23 06:27:06 字數 1732 閱讀 2095

nginx的版本號相關

隱藏版本號

nginx隱藏版本號需要將主配置檔案中server_tokens關閉

server_tokens off;檢視頭資訊

server: nginx #現在已經不顯示nginx的版本號了

date: fri, 31 may 2019 12:32:23 gmt

content-type: text/html

content-length: 15

last-modified: thu, 30 may 2019 15:33:51 gmt

connection: keep-alive

keep-alive: timeout=65

etag: "5ceff7df-f"

accept-ranges: bytes徹底隱藏server資訊

如果需要徹底的隱藏server資訊,連nginx都不顯示就需要修改原始碼將原始碼包內的ngx_http_header_filter_module.c檔案進行修改1.修改原始碼

#將此檔案內的第49行中的server之後的部分全部刪除,然後重新編譯2.檢查編譯環境及工具

[root@www nginx-1.14.2]# ./configure --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --add-module=/root/echo-nginx-module3.生成相應模組並複製模組到指定目錄

[root@www nginx-1.14.2]# make && make install4.啟動服務

[root@www nginx-1.14.2]# systemctl start nginx5.再次檢視頭資訊

server: #server資訊已經徹底的隱藏

date: fri, 31 may 2019 12:50:10 gmt

content-type: text/html

content-length: 15

last-modified: thu, 30 may 2019 15:33:51 gmt

connection: keep-alive

keep-alive: timeout=65

etag: "5ceff7df-f"

accept-ranges: bytes

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...