response header一般都是以key:value的形式,例如:“Content-Encoding:gzip、Cache-Control:no-store”,设置的命令为:
复制代码 代码如下:
add_header Cache-Control no-store
add_header Content-Encoding gzip

但是有一个十分常用的response header比较特性,就是Content-Type,可以在它设置了类型的同时还会指定charset,例如:“text/html; charset=utf-8”,由于其存在分号,而分号在配置文件中作为结束符,所以在配置的时候需要用引号把其引起来,配置如下:

复制代码 代码如下:
add_header  Content-Type 'text/html; charset=utf-8';

另外由于没有单独设置charset的key,所以要设置响应的charset就需要使用Content-Type来指定charset。

标签:
nginx,add_header,指令

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“nginx add_header指令使用方法”

暂无“nginx add_header指令使用方法”评论...