The Python Oracle

Django React Nginx serving admin static files

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 Question
01:54 Accepted answer (Score 3)
02:42 Thank you

--

Full question
https://stackoverflow.com/questions/4249...

Accepted answer links:
[the ]: http://nginx.org/en/docs/http/ngx_http_c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #css #django #nginx

#avk47



ACCEPTED ANSWER

Score 3


Your location /static is wrong. The alias directive substitutes parts of the URI when forming the pathname. The location parameter and the alias parameter should both end with a /, or neither end with a /:

location /static {
    alias /root/se/env/public/static;
}

or:

location /static/ {
    alias /root/se/env/public/static/;
}

In fact, because the alias parameter ends with the location parameter, you should not be using the alias directive at all. See the note at the end of the alias documentation.

location /static {
    root /root/se/env/public;
}