Nginx和CSS问题

时间:2013-10-07 07:55:10

标签: python css nginx uwsgi corruption

我已经为一个python网站设置了一个带有uwsgi的本地Nginx服务器,其中包含以下配置

server {
    root /var/www/localhost/current;
    index index.html index.htm;
    server_name localhost;

    location /static {
        alias /var/www/localhost/current/static;
    }

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/localhost.sock;
        uwsgi_param UWSGI_PYHOME /var/www/localhost;
        uwsgi_param UWSGI_CHDIR /var/www/localhost/current;
        uwsgi_param UWSGI_MODULE wsgi;
        uwsgi_param UWSGI_CALLABLE application;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
       root /usr/share/nginx/www;
    }
}

uwsgi config:

[uwsgi]
plugins=python
vhost=true
socket=/tmp/localhost.sock

当我对位于/static文件夹中的CSS文件进行更改时,当我在浏览器中访问它时,我得到以下内容:

Bad CSS File

这就是CSS的样子:

body {
    background-color: #002b36;
    position: relative;
    padding-top: 50px;
    color: #93a1a1;
}

如果我删除color: #93a1a1;我没有获得\u0字符。关于这可能是什么的任何想法?

1 个答案:

答案 0 :(得分:2)

上面没有提到但可能应该有。服务器在VirtualBox中运行。

感谢服务器故障中的这个question我已将sendfile off;添加到已修复问题的/static配置中。

location /static {
    alias /var/www/localhost/current/static;
    sendfile off;
}