types 指令

语 法: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;
}
说说我的看法
全部评论(
没有评论
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号