1

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?

4
  • I know this is silly, but have you tried to delete it and type it without pasting it ? Commented Oct 7, 2013 at 7:58
  • @MohammadAbuShady not silly at all and I have, it was the first thing I did. Commented Oct 7, 2013 at 7:59
  • the issue looks like it's after } did you try to like mark every thing after it and delete it ? Commented Oct 7, 2013 at 8:04
  • The CSS file contains only the CSS above and a newline at the end of the file. There is nothing else in it. Might it be a character encoding issue? Commented Oct 7, 2013 at 8:07

1 Answer 1

2

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;
}
Sign up to request clarification or add additional context in comments.

6 Comments

well this kinda raises a question, without this sendfile what is the detected content-type for the css file on the browser?
The content-type without sendfile in the config was text/css and with it is also text/css.
i mean in the browser, like in firebug or some inspector
That is what I was referring to.
Thanks for this, was getting the same issue with javascript files.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.