小知识:Nginx隐藏和伪造版本号的操作方法

1、默认使用curl命令访问:

# curl -I http://172.17.0.5

%小知识:Nginx隐藏和伪造版本号的操作方法-猿站网-插图

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

?
1
2
# vim /usr/local/nginx/conf/nginx.conf
server_tokens off;

%小知识:Nginx隐藏和伪造版本号的操作方法-1猿站网-插图

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

?
1
2
# 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隐藏和伪造版本号的操作方法-2猿站网-插图

6、伪造Nginx的名称和版本号:

?
1
2
3
4
5
6
7
8
9
10
# 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隐藏和伪造版本号的操作方法-3猿站网-插图

总结

以上所述是小编给大家介绍的Nginx隐藏和伪造版本号的操作方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

原文链接:https://blog.51cto.com/qiuyue/2457277

声明: 猿站网有关资源均来自网络搜集与网友提供,任何涉及商业盈利目的的均不得使用,否则产生的一切后果将由您自己承担! 本平台资源仅供个人学习交流、测试使用 所有内容请在下载后24小时内删除,制止非法恶意传播,不对任何下载或转载者造成的危害负任何法律责任!也请大家支持、购置正版! 。本站一律禁止以任何方式发布或转载任何违法的相关信息访客发现请向站长举报,会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。本网站的资源部分来源于网络,如有侵权烦请发送邮件至:2697268773@qq.com进行处理。
建站知识

小知识:详解Linux 虚拟机根分区磁盘扩充空间记录

2023-4-2 4:00:49

建站知识

小知识:linux下安装nodejs及npm的方法

2023-4-2 4:09:19

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索