美文网首页
nginx/1.2.7 css文件Content-Type为te

nginx/1.2.7 css文件Content-Type为te

作者: k1ic | 来源:发表于2015-05-20 09:51 被阅读4820次

1.环境

Linux version 2.6.32-431.el6.x86_64

CentOS release 6.5 (Final)

Nginx version: nginx/1.2.7

PHP 5.4.11 (fpm-fcgi)

2.问题

新增一个基于域名的虚拟主机后,访问该虚拟主机目录下的css文件,Response Headers 中的Content-Type值为 text/html

http://k1ic.com/static/frame.css

nginx.conf

nginx.conf

k1ic.com.conf

k1ic.com.conf

3.解决

注意到配置php-fpm处为通配符“/”,使得所有请求均会被php-fpm处理,导致css文件的响应头出错,修改如下:

k1ic.com.conf

重启nginx服务

http://k1ic.com/static/frame.css

http://k1ic.com/static/frame.css

4.分析

img ps -ef | grep nginx | grep -v grep

strace -p 14527

strace -p 14527

nginx模块分类

nginx模块分类

5.参考资料

1.Nginx fails to load css files

2.nginx always handle css as text/plain

3.http://forum.nginx.org/read.php?2,155222,155230

4.http://yansu.org/2014/02/15/apache-and-nginx.html

5.http://wiki.nginx.org/ServerBlockExample

6.http://www.cnblogs.com/xiaogangqq123/archive/2011/03/02/1969006.html

7.http://my.oschina.net/u/1156660/blog/364955

8.http://bg.biedalian.com/2014/09/08/useful-nginx-fragment.html

9.http://www.oschina.net/question/17_655

10.http://huanghuizz.iteye.com/blog/1909180

11.http://tengine.taobao.org/book/chapter_02.html

12.http://www.pagefault.info/?p=123

相关文章

网友评论

      本文标题:nginx/1.2.7 css文件Content-Type为te

      本文链接:https://www.haomeiwen.com/subject/bzylqttx.html