比尔盖子 博客

Nginx导致CSS无法解析

比尔盖子最近在对服务器进行重构,在重构过程中,比尔盖子用Nginx取代了Apache,结果发现博客页面不正常了,像是主题文件损坏的样子。而换成Wordpress默认的主题Twenty Ten就没事了。

比尔盖子重新安装了主题,但依然不起作用,只好打看Firefox万能的错误控制台进行调试,结果发现了以下错误信息:

错误: 样式表单 http://biergaizi.info/wp-content/themes/philna2/style.css?v=201001171531 未载入,因为它的MIME类型 “text/plain” 不是 “text/css”。
源文件:http://biergaizi.info/
行:0

网上对这种错误众说纷纭,有的是IE的兼容性问题;还有是XHTML的问题。
最后发现,原来是配置Nginx的时候将/etc/nginx/nginx.conf的一行include /etc/nginx/mime.types;误删了,导致了Nginx无法正确识别CSS文件,因此向浏览器发送了错误的MIME类型。加上那行,然后重启Nginx守护进行就好了。

 

Categories: 建站技术, 建站那点事

说说明文密码那些事 » « Gentoo GCC报错解决

3 Comments

  1. 现在我博客也j加载不出CSS,求解

  2. 这样的事之多难以想象。。。

发表评论

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Copyright © 2023 比尔盖子 博客

Theme by Anders NorenUp ↑