溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Nginx如何隱藏和偽造版本號

發(fā)布時間:2021-08-21 11:06:16 來源:億速云 閱讀:176 作者:小新 欄目:服務(wù)器

這篇文章給大家分享的是有關(guān)Nginx如何隱藏和偽造版本號的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

1、默認使用curl命令訪問:

# curl -I http://172.17.0.5

Nginx如何隱藏和偽造版本號

2、修改nginx.conf配置文件,在http配置段中新增如下代碼:

# vim /usr/local/nginx/conf/nginx.conf
server_tokens off;

Nginx如何隱藏和偽造版本號

3、修改fastcgi.conf配置文件,注釋如下代碼:

# vim /usr/local/nginx/conf/fastcgi.conf
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

4、重載Nginx:

# nginx -s reload

5、使用curl命令訪問:

# curl -I http://172.17.0.5

Nginx如何隱藏和偽造版本號

6、偽造Nginx的名稱和版本號:

# vim /usr/src/nginx-1.16.1/src/core/nginx.h,修改如下代碼
#define NGINX_VERSION "1.16.1" --> #define NGINX_VERSION "2.3.2"
#define NGINX_VER "nginx/" NGINX_VERSION --> #define NGINX_VER "Tengine/" NGINX_VERSION
# cd /usr/src/nginx-1.16.1
# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module --with-stream_ssl_preread_module --with-compat --with-pcre
# make && make install
# cd /usr/local/nginx/conf
# vim nginx.conf,刪除之前新增的代碼:server_tonkens off;
# nginx -s stop
# nginx

7、使用curl命令訪問:

# curl -I http://172.17.0.5

Nginx如何隱藏和偽造版本號

感謝各位的閱讀!關(guān)于“Nginx如何隱藏和偽造版本號”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI