如何隐藏nginx版本号:
[root@localhost /]# vi /etc/nginx/nginx.conf
[root@localhost /]# nginx -t
[root@localhost /]# nginx -s reload
配置文件中,http区段中插入“server_tokens off;”,重新载入配置文件
复制代码
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
expires 5s;
sendfile on;
复制代码
隐藏或修改nginx返回的Server信息:
复制代码
[root@localhost /]# vi /opt/nginx/nginx-1.2.0/src/http/ngx_http_special_response.c
找到29行:修改展示名称(LLSERVER)
[root@localhost /]# ”
[root@localhost /]# cd /opt/nginx/nginx-1.2.0/src/http/ngx_http_header_filter_module.c
[root@localhost /]# vi /opt/nginx/nginx-1.2.0/src/http/ngx_http_header_filter_module.c
找到49和50行: 修改展示名称(Server: LLSERVER)
[root@localhost /]# static char ngx_http_server_string[] = “Server: LLSERVER” CRLF;
[root@localhost /]# static char ngx_http_server_full_string[] = “Server: LLSERVER ” NGINX_VER CRLF;
复制代码
隐藏nginx请求头header:修改nginx.conf ,在location中添加配置如下:
[root@localhost /]# proxy_hide_header X-Frame-Options; //将X-Frame-Options换成Location
[root@localhost /]# add_header X-Frame-Options SAMEORIGIN always; //将X-Frame-Options换成Location 赞赏
微信赞赏
支付宝赞赏
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 关于编程知识分享网(www.ittce.com)