문제

I've set up a local Nginx server with uwsgi for a python website with the following config

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

When I make changes to my CSS file which is located in the /static folder I get the following when I visit it in a browser:

Bad CSS File

This is what the CSS should look like:

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

If I remove color: #93a1a1; I don't get the \u0 character. Any idea's on what this could be?

도움이 되었습니까?

해결책

Didn't mention above but probably should have. The server is running in VirtualBox.

Thanks to this question on serverfault I've added sendfile off; to the /static configuration which has fixed the issue.

location /static {
    alias /var/www/localhost/current/static;
    sendfile off;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top