A
A
alexse2016-06-10 21:21:35
Django
alexse, 2016-06-10 21:21:35

Nginx doesn't serve static. How to do?

I still can't set up nginx in such a way that it gives out static. I'm posting my first website. I use gunicorn as WSGI.
I use Ubuntu 14.04, the configuration is in the default file in the sites-available folder, I made a soft-link for it in the sites-enabled folder.

server {
        root /usr/share/nginx/www;
        index index.html index.htm;

        server_name localhost;

        location /static/ {
            alias /root/blogapp/blog/static/;
            expires 30d;
        }

        location / {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_pass http://127.0.0.1:8000;
                proxy_pass_header Server;
                proxy_set_header X-Real-IP $remote_addr;
                # proxy_set_header X-Scheme $scheme;
                proxy_connect_timeout 10;
                proxy_read_timeout 10;
                # proxy_set_header SCRIPT_NAME /;
        }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-06-10
@aleksse

alias /root/blogapp/blog/static/;
replaced by:
root /root/blogapp/blog;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question