
Expires:设置响应内容的过期时间。用于静态文件缓存配置。
location ~ .(gif|jpg|png|js|css)$ {  
  expires 1h;   # 1小时过期
}
Content-Type:设置响应内容的MIME类型和字符集。
default_type text/html; charset utf-8;
Cache-Control:控制缓存,如no-cache禁用缓存、max-age设置缓存时间等。用于静态文件缓存配置。
location ~ .(gif|jpg|png|js|css)$ {  
  add_header Cache-Control "public, max-age=3600"; 
}
Server:服务器信息,一般隐藏或设置为Nginx。
 server_tokens off; # 隐藏Server响应头
 Location:重定向使用的位置信息。
location /old/ {
  return 301 /new/;  # 301永久重定向
}
Content-Encoding:响应内容的编码格式,如gzip。
 gzip on; # 开启gzip压缩
 gzip_types text/plain text/css text/xml; # 设置压缩类型
 Content-Disposition:attachments设置响应内容的下载及文件名。
location ~* .(xlsx|doc)$ {  
  add_header Content-Disposition "attachment; filename=$1"; 
}
X-Frame-Options:用于防止网页被Frame掌握,以防止点击劫持。
add_header X-Frame-Options "SAMEORIGIN";
Nginx如何快速提高网站响应速度(Nginx Proxy Manager)
标签: Content-Encoding, Expires缓存配置, HTTP头, max-age设置缓存时间, nginx, nginx配置, no-cache禁用缓存, X-Frame-Options
上面是“Nginx支持哪些常见的HTTP头?(附配置说明)”的全面内容,想了解更多关于 前端知识 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_5059.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

 生僻字“曱甴亽仒”这四个字是什么意思?
 帝国CMS6.0如何调用会员空间信息标签