duplicate MIME type "text/html" in nginx.conf错误

今天维护nigix时重新加载时发现一个duplicate MIME type "text/html" in nginx.conf错误
于是查找发现下面解决问题,记录一下学习。


把nginx升级到最新以后,发现用原来的配置启动的时候会提示:

duplicate MIME type "text/html" in /usr/local/nginx/conf/nginx.conf:37

   

实际上,text/html根本就不需要写的,gzip默认就会压缩它的,只不过以前的nginx版本不提示这个警告而已,新版本的会出这个警告,所以解决办法很简单:把text/html从你的配置中删除(我把text/htm改成text/htm也通过了,不知道有没有区别)。

[root@server1 nginx]# vi conf/nginx.conf

:37

gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

原文链接:https://blog.csdn.net/gianttj/article/details/84878967

猜你喜欢

转载自blog.csdn.net/weixin_44495941/article/details/105125559