小知识:Nginx隐藏服务器端各类信息的方法

有时我们不希望有人可以通过一些工具来返回我们服务器的信息,下面我来介绍在nginx隐藏nginx响应头,修改nginx返回头信息,隐藏php版本号,隐藏服务器信息,同学可参考。

首先隐藏nginx版本信息,只需编辑 nginx.conf 文件

添加一行

server_tokens off;  http {    include    /etc/nginx/mime.types;    default_type application/octet-stream;    index index.php index.html index.htm;    server_tokens off;    log_format main $remote_addr – $remote_user [$time_local] “$request”             $status $body_bytes_sent “$http_referer”             “$http_user_agent” “$http_x_forwarded_for”   access_log /var/log/nginx/access.log main;    sendfile    on;    #tcp_nopush   on;   keepalive_timeout 65;    #gzip on;   include /etc/nginx/conf.d/*.conf; 

响应头隐藏PHP版本休息,编辑php.ini文件找到expose_php = On , 修改为 expose_php = Off

;;;;;;;;;;;;;;;;;  ; Miscellaneous ;  ;;;;;;;;;;;;;;;;;  ; Decides whether PHP may expose the fact that it is installed on the server  ; (e.g. by adding its signature to the Web server header). It is no security  ; threat in any way, but it makes it possible to determine whether you use PHP  ; on your server or not.  ; http://www.php.net/manual/en/ini.core.php#ini.expose-php expose_php = Off 
声明: 猿站网有关资源均来自网络搜集与网友提供,任何涉及商业盈利目的的均不得使用,否则产生的一切后果将由您自己承担! 本平台资源仅供个人学习交流、测试使用 所有内容请在下载后24小时内删除,制止非法恶意传播,不对任何下载或转载者造成的危害负任何法律责任!也请大家支持、购置正版! 。本站一律禁止以任何方式发布或转载任何违法的相关信息访客发现请向站长举报,会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。本网站的资源部分来源于网络,如有侵权烦请发送邮件至:2697268773@qq.com进行处理。
建站知识

小知识:linux Vim基本操作方法

2023-5-4 4:27:26

建站知识

小知识:Vim命令高级用法

2023-5-4 4:35:40

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