nginx - Resource interpreted as Stylesheet but transferred with MIME type text/plain

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx - Resource interpreted as Stylesheet but transferred with MIME type text/plain相关的知识,希望对你有一定的参考价值。

在部署前端项目的时候,网站跑起来了,可就是css样式没加载出来,查看css文件也已经load进来,被坑了3个小时终于发现问题所在:

nginx.conf中添加下面两行配置即可,可参考nginx默认配置文件

 

include mime.types;

default_type application/octet-stream;

 

如果不设置css文件就会被当作text/plain类型发送到浏览器。从而导致css样式无法显示

以上是关于nginx - Resource interpreted as Stylesheet but transferred with MIME type text/plain的主要内容,如果未能解决你的问题,请参考以下文章

nginx - Resource interpreted as Stylesheet but transferred with MIME type text/plain

已解决:上传文件时因Nginx导致的No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.

已解决:上传文件时因Nginx导致的No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.

nginx 解决跨域问题 No: 'Access-Control-Allow-Origin' header is present on the requested resource.(

[原创]Flask+uwsgi+virtualenv+nginx部署配置

rm -rf XXXXX:Device or resource busy问题解决