青岛网站建设新闻资讯

网站安全响应头缺失和php配置漏洞

时间:2022-09-02 已阅读:1073次 | 作者:青岛网站建设

首页>新闻资讯>建站知识

网站安全响应头缺失和php配置漏洞解决方法。

php.ini 中修改

expose_php off    //  php彩蛋信息泄露
session.cookie_httponly=true  //  cookie没有设置httponly属性

PHP 配置

header("X-Frame-Options:SAMEORIGIN;");  // X-Frame-Options 响应头缺失
header("Referer-Policy:origin;");//Referer-Policy 响应头缺失
header("Content-Security-Policy:frame-ancestors 'self';");//Content-Security-Policy 响应头缺失
header("X-Permitted-Cross-Domain-Policies:'master-only';");//X-Permitted-Cross-Domain-Policies 响应头缺失
header("X-XSS-Protection:1; mode=block;");//X-XSS-Protection 响应头缺失
header("X-Download-Options: SAMEORIGIN;");//X-Download-Options 响应头缺失
header("X-Content-Type-Options:nosniff;");//X-Content-Type-Options 响应头缺失
header("Strict-Transport-Security:max-age=31536000;");//Strict-Transport-Security 响应头缺失

Nginx 配置

add_header X-Frame-Options SAMEORIGIN;
add_header Referer-Policy origin;
add_header Content-Security-Policy "frame-ancestors 'self'";
add_header X-Permitted-Cross-Domain-Policies  "master-only";
add_header X-XSS-Protection "1; mode=block;";
add_header X-Download-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header Strict-Transport-Security max-age=31536000;



二维码
扫描二维码手机查看该文章

文章引用:https://www.qinghuahulian.com/news/webzhishi/1290.html

相关资讯

Copyright © 2011-2024 青华互联-青岛青华锐思网络科技有限公司 www.qinghuahulian.com All Rights Reserved
鲁公网安备37020202000800号 鲁ICP备14020555号-4 网站地图 百度地图