我在网上找到了解决方法。我在/etc/nginx/conf.d/default.conf中添加了以下内容:
location ~ .css { add_header Content-Type text/css;}location ~ .js { add_header Content-Type application/x-javascript;}现在的问题是,对我的css文件的请求未正确重定向,好像root设置不正确。在error.log我看到
2012/04/11 14:01:23 [错误] 7260#0:* 2 open()“ /etc/nginx//html/style.css”
因此,作为第二种解决方法,我将根添加到每个定义的位置。现在可以使用,但似乎有点多余。根不是从/位置继承吗?



