nginx mime types and gzip

The most comprehensive, modern, and compatible configuration is found in the h5bp GitHub repository.

application/x-javascript is old and not needed for Internet Explorer support.

I won't paste the configurations here, because some people might copy/paste them. Instead I directly link to the master files within the h5bp repository. This ensures that people will always copy/paste the latest version:

  • mime.types
  • gzip_types

Generally it's wise to only set the MIME/gzip types that you're really going to serve. This will speed up nginx because it can fall back very fast and the list is short.


I've compiled a list that is shorter and I believe more appropriate for today's standards:

types {
    application/atom+xml                atom;
    application/dart                    dart;
    application/gzip                    gz;
    application/java-archive            jar war ear;
    application/javascript              js jsonp;
    application/json                    json;
    application/owl+xml                 owl owx;
    application/pdf                     pdf;
    application/postscript              ai eps ps;
    application/rdf+xml                 rdf;
    application/rss+xml                 rss;
    application/vnd.ms-fontobject       eot;
    application/x-7z-compressed         7z;
    application/x-bittorrent            torrent;
    application/x-chrome-extension      crx;
    application/x-font-otf              otf;
    application/x-font-ttf              ttc ttf;
    application/x-font-woff             woff;
    application/x-opera-extension       oex;
    application/x-rar-compressed        rar;
    application/x-shockwave-flash       swf;
    application/x-web-app-manifest+json webapp;
    application/x-x509-ca-cert          crt der pem;
    application/x-xpinstall             xpi;
    application/xhtml+xml               xhtml;
    application/xml                     xml;
    application/xml-dtd                 dtd;
    application/zip                     zip;

    audio/midi                          kar mid midi;
    audio/mp4                           aac f4a f4b m4a;
    audio/mpeg                          mp3;
    audio/ogg                           oga ogg;
    audio/vnd.wave                      wav;
    audio/x-flac                        flac;
    audio/x-realaudio                   ra;

    image/bmp                           bmp;
    image/gif                           gif;
    image/jpeg                          jpe jpeg jpg;
    image/png                           png;
    image/svg+xml                       svg svgz;
    image/tiff                          tif tiff;
    image/webp                          webp;
    image/x-icon                        cur ico;

    text/cache-manifest                 appcache manifest;
    text/css                            css less;
    text/csv                            csv;
    text/html                           htm html shtml;
    text/mathml                         mml;
    text/plain                          txt;
    text/rtf                            rtf;
    text/vcard                          vcf;
    text/vtt                            vtt;
    text/x-component                    htc;
    text/x-markdown                     md;

    video/3gpp                          3gp 3gpp;
    video/avi                           avi;
    video/mp4                           f4p f4v m4v mp4;
    video/mpeg                          mpeg mpg;
    video/ogg                           ogv;
    video/quicktime                     mov;
    video/webm                          webm;
    video/x-flv                         flv;
    video/x-matroska                    mkv;
    video/x-ms-wmv                      wmv;
}

I've deliberatly ommited all the Office related types.