Project

General

Profile

Actions

mimetype.assign option

Description

mimetype.assign

list of known mimetype mappings from file extension to mimetype (and returned in HTTP response header Content-Type)
Note: lighttpd 1.4.71 and later provide a default set of the most common web extension mappings if lighttpd.conf does not set mimetype.assign
Note: if no file extension mapping matches the response file, then "application/octet-stream" is used

Example:

mimetype.assign   = ( ".png"  => "image/png",
                      ".jpg"  => "image/jpeg",
                      ".jpeg" => "image/jpeg",
                      ".html" => "text/html",
                      ".txt"  => "text/plain;charset=utf-8" )

The list is compared top down and the first match is taken (since lighttpd 1.4.46, only if mimetype.assign contains 16 entries or fewer). This is important if you have matches like:

      ".tar.gz" => "application/x-tgz",
      ".gz" => "application/x-gzip",

The matches are suffix matches, so files without extensions can also be assigned mimetypes

      "README" => "text/plain",

If you want to set a default mimetype, set a value for an empty string as the last entry in the list.

      ...,
      "" => "text/plain" )

If you want to use lighttpd built-in common web mime types, but need to make a modification, you can provide your own long list of mimetype.assign or you can selectively override with lighttpd conditions, e.g. the non-standard .map

$HTTP["url"] =$ ".map" {
      mimetype.assign = ("" => "application/json")
}

See Also

Updated by gstrauss 2 days ago · 12 revisions