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。