types

Syntax: types { ... }
Default: types { text/html html; image/gif gif; image/jpeg jpg; }
Context: http, server, location

Maps file name extensions to MIME types of responses. Extensions are case-insensitive. Several extensions can be mapped to one type, for example:

1
2
3
4
5
types {
    application/octet-stream bin exe dll;
    application/octet-stream deb;
    application/octet-stream dmg;
}

A sufficiently full mapping table is distributed with nginx in the conf/mime.types file.

To make a particular location emit the “application/octet-stream” MIME type for all requests, the following configuration can be used:

1
2
3
4
location /download/ {
    types        { }
    default_type application/octet-stream;
}
doc_nginx
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.