语 法:types { ... }
默认值:
types {
text/html html;
image/gif gif;
image/jpeg jpg;
}上下文:http, server, location
将文件扩展名映射到 MIME 类型的响应。扩展名不区分大小写。多个扩展可以映射到一种类型,例如:
types {
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
}在 conf/mime.types 文件中随 nginx 分发了一个足够完整的映射表。
要使特定 location 为所有请求发出“application/octet-stream”MIME 类型,可以使用以下配置:
location /download/ {
types { }
default_type application/octet-stream;
}