我的网站在 nginx 服务器上。我添加到/etc/nginx/nginx.conf
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
标题未出现在网站上:
答案 0 :(得分:0)
我们需要更多关于您的 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/*;
}