Investigating the Nginx Error "duplicate MIME type 'text/html' in /etc/nginx/nginx.conf"
Overview
Having error logs sent to Slack as notifications is really convenient.

エラーログをSlack通知する - 長生村本郷Engineers'Blog
以下に移行しました。 kenzo0107.github.io
Once in a while, though, something shows up that makes you go “what is this?”
One of those is the error in the title.
1 | duplicate MIME type "text/html" in /etc/nginx/nginx.conf |
Looking at nginx.conf, it was the text/html that I had set in gzip_types.
Translated literally, it says:
1 | The MIME type "text/html" is duplicated in /etc/nginx/nginx.conf. |
So I figured I could just remove it, and removing it solved the problem.
/etc/nginx/nginx.conf
1 | gzip on; |
Is it specified somewhere else?
To get to the point:
- if you have
ngx_http_gzip_moduleinstalled - and you set
gzip on
then text/html is specified as a MIME type by default.
You can confirm this by checking the official site below.
It says that the text/html type is always subject to compression.
So when you do gzip compression, text/html is unnecessary.
And that was the answer.
