5-1 MIME type与文件扩展的映射
语法:types {...);
配置块:http,server,location
定义MIME type到文件扩展名的映射。例如:
types {
text/html html;
text/html conf;
image/gif gif;
image/jpeg jpg;
}
5-2 默认MIME type
语法:default_type MEME-type;
默认:default_type text/plain;
配置块:http,server,location
当找不到相应的MIME type与文件扩展名之间的映射时,使用默认的MIME type作为http header中的Content-Type
5-3 types_hash_bucket_size
语法:types_hash_bucket_size size;
默认:types_hash_bucket_size 32|64|128;
配置块:http,server,location
为了快速寻找到相应MIME type,nginx使用散列表来存储MIME type与文件扩展名。此参数设置了每个散列桶占用的内存大小
5-4 types_hash_max_size
语法:types_hash_max_size size;
默认:types_hash_max_size 1024;
配置块:http,server,location
types_hash_max_size影响散列表的冲突率,越大,消耗越多内存,但散列key的冲突率会降低,检索速度更快。