Nginx隱藏和偽造版本號的操作方法
1、默認(rèn)使用curl命令訪問:
# curl -I http://172.17.0.5
2、修改nginx.conf配置文件,在http配置段中新增如下代碼:
# vim /usr/local/nginx/conf/nginx.conf server_tokens off;
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
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
總結(jié)
以上所述是小編給大家介紹的Nginx隱藏和偽造版本號的操作方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!
相關(guān)文章
Nginx服務(wù)器中使用gzip壓縮的相關(guān)配置解析
這篇文章主要介紹了Nginx服務(wù)器中使用gzip壓縮的相關(guān)配置解析,包括對gzip請求處理相關(guān)的壓縮配置,需要的朋友可以參考下2015-12-12centos系統(tǒng)下LNMP環(huán)境一鍵安裝
centos下的LNMP環(huán)境一鍵安裝實(shí)現(xiàn)方法,需要的朋友可以參考下。2010-06-06Nginx加固的幾種方式(控制超時(shí)時(shí)間&限制客戶端下載速度&并發(fā)連接數(shù))
本文主要介紹了Nginx加固的幾種方式,包括控制超時(shí)時(shí)間,限制客戶端下載速度,并發(fā)連接數(shù)這幾種方式,具有一定的參考價(jià)值,感興趣的可以了解一下2024-03-03基于nginx設(shè)置瀏覽器協(xié)商緩存過程詳解
這篇文章主要介紹了基于nginx設(shè)置瀏覽器協(xié)商緩存過程詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-12-12