手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

nginx add_header指令使用方法

时间:2024-10-18 10:47:21

response header一般都是以key:value的形式,例如:“Content-Encodi荏鱿胫协ng:gzip、Cache-Control:no-store”,设置的命令为:

复制代码代码如下:

add_header Cache-Control no-storeadd_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。

© 手抄报圈