nginx添加add_header能启动,但不生效,也不报错
配置如下:
server {
listen 80;
server_name localhost;
server_tokens off;
#access_log logs/host.access.log main;
location / {
add_header X-Frame-Options 'SAMEORIGIN'; # 只允许本站用 frame 来嵌套
add_header X-XSS-Protection '1; mode=block'; # XSS 保护
add_header X-Content-Type-Options 'nosniff';#响应头可以禁用浏览器的类型猜测行为
root /mnt/hexo-auto-deploy/hexo/public;
index index.html index.htm;
}
location ~.*\.(js|css)?$ {
access_log off;
expires 1h;
}
location ~* ^.+\.(eot|ttf|otf|woff|woff2|svg)$ {
access_log off;
expires max;
}
试着把 add_header放各种地方也没用,我认输
主机是ecs ubuntu nginx版本1.13.0
测了下nginx -t也说没错,是在下输了