Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php会话cookie不工作-ngnix.conf-位置块-安全标头nginx_Php_Nginx_Http Headers_Session Cookies - Fatal编程技术网

php会话cookie不工作-ngnix.conf-位置块-安全标头nginx

php会话cookie不工作-ngnix.conf-位置块-安全标头nginx,php,nginx,http-headers,session-cookies,Php,Nginx,Http Headers,Session Cookies,我试图在我的服务器上的特定文件上应用安全头,并在nginx.conf中使用此配置 location /test.php { add_header X-XSS-Protection "1; mode=block" always; add_header X-Frame-Options SAMEORIGIN always; add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; prelo

我试图在我的服务器上的特定文件上应用安全头,并在nginx.conf中使用此配置

location /test.php {
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Frame-Options SAMEORIGIN always;
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
add_header Content-Security-Policy "your-policy-here" always;
}
当我像这样将这些安全头添加到此位置时,php会话cookie停止处理此文件

然后,我尝试在整个nginx.conf级别应用这些头文件,基本上是所有文件的默认值。php会话cookie在test.php文件上运行良好

我想知道我遗漏了什么,所以php会话cookie也可以在这个设置中工作

location /test.php {
security headers here
}
希望这是有意义的。我不擅长描述问题。我在任何地方都找不到解决办法,所以我决定去问。谢谢你在这方面的帮助。干杯