nginx - X-Frame-Options 标头未设置为 nginx
问题描述
我的网站在 nginx 服务器上。我添加到 /etc/nginx/nginx.conf
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
标题未出现在网站上:
解决方案
我们需要更多关于您的nginx.conf
文件的信息,但您可以将此指令添加到您的server
块中:
server {
listen 80;
server_name example.com;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
# ...
}
可能位于/etc/nginx/sites-enabled/example.com
或/etc/nginx/conf.d/example.com.conf
。
如http
块中所示/etc/nginx/nginx.conf
:
http {
# ...
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
推荐阅读
- angular - 在经纬度角 bingmap 周围画圆
- go - File.Readdir() 不能多次调用?
- visual-studio - Xamarin.Android 快速部署被禁用
- android - 在自定义工具栏中正确对齐两个图像视图 - android
- vba - 删除word VBA中几个书签之间的文本
- javascript - 如何使用 React js 在 onchange 中将数据从一个组件传递到另一个组件
- dart - Flutter- 使用 BlendMode.xor 取消屏蔽公共部分
- azure - 使用 powershell 在 Azure VM 上启动和停止 Windows 服务
- java - 在 vert.x 中,为什么静态方法在静态代码块之前运行?
- javascript - 如何验证语义用户界面中的十进制字段?