Nginx隱藏和偽造版本號(hào)的操作方法
1、默認(rèn)使用curl命令訪問(wèn):
# 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命令訪問(wèn):
# curl -I http://172.17.0.5

6、偽造Nginx的名稱(chēng)和版本號(hào):
# 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命令訪問(wèn):
# curl -I http://172.17.0.5

總結(jié)
以上所述是小編給大家介紹的Nginx隱藏和偽造版本號(hào)的操作方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
相關(guān)文章
Nginx之正向代理與反向代理進(jìn)階方式(支持https)
文章介紹了如何在Nginx中實(shí)現(xiàn)正向代理和反向代理對(duì)HTTP和HTTPS協(xié)議的支持,通過(guò)使用第三方模塊`ngx_http_proxy_connect_module`和Nginx內(nèi)置的`ngx_http_ssl_module`,可以實(shí)現(xiàn)Nginx對(duì)HTTPS的正向和反向代理2025-03-03
nginx 不同的訪問(wèn)路徑對(duì)應(yīng)項(xiàng)目不同的目錄的實(shí)現(xiàn)方法
要在 Nginx 中配置不同的訪問(wèn)路徑對(duì)應(yīng)不同的項(xiàng)目目錄,可以使用 Nginx 的?location?指令來(lái)實(shí)現(xiàn),本文主要介紹了nginx不同的訪問(wèn)路徑對(duì)應(yīng)項(xiàng)目不同的目錄的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的可以了解一下2023-09-09
Nginx配置二級(jí)域名的方法實(shí)現(xiàn)
本文主要介紹了Nginx配置二級(jí)域名的方法實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-03-03
Nginx實(shí)現(xiàn)高可用集群構(gòu)建(Keepalived+Haproxy+Nginx)
為什么需要搭建Nginx集群?為了防止Nginx單點(diǎn)故障造成服務(wù)器癱瘓,本文介紹了Nginx實(shí)現(xiàn)高可用集群構(gòu)建(Keepalived+Haproxy+Nginx),感興趣的可以了解一下2021-05-05
nginx設(shè)置上傳目錄無(wú)執(zhí)行權(quán)限的方法
在windows+iis下,可以設(shè)置上傳目錄,類(lèi)似:upload,uploadfile,attachments,這樣的目錄下面無(wú)腳本執(zhí)行權(quán)限,從而防止非法用戶(hù)上傳腳本得到webshell2010-11-11
nginx反向代理https內(nèi)部定向到http報(bào)302的問(wèn)題及解決
這篇文章主要介紹了nginx反向代理https內(nèi)部定向到http報(bào)302的問(wèn)題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-12-12
Nginx listen 監(jiān)聽(tīng)端口的實(shí)現(xiàn)配置
本文將介紹Nginx的listen指令及其在配置文件中的應(yīng)用,通過(guò)了解listen指令,我們可以知道Nginx如何監(jiān)聽(tīng)端口,并配置相應(yīng)的服務(wù)器塊來(lái)處理進(jìn)入的請(qǐng)求2023-12-12

