[ACCEPTED]-Nginx doesn't serve static-nginx
Accepted answer
How is your directory setup? Do you have 6 a folder static
in /home/user/www/oil/oil_database/static_files
? In that case, the directive 5 should look like this (note the trailing 4 slash in /static/
):
location /static/ {
autoindex on;
root /home/user/www/oil/oil_database/static_files;
}
If you want to map the path /home/user/www/oil/oil_database/static_files
to 3 the URL /static/
, you have to either
rename the folder 2
static_files
tostatic
and use this directive:location /static/ { autoindex on; root /home/user/www/oil/oil_database/; }
use an alias:
location /static/ { autoindex on; alias /home/user/www/oil/oil_database/static_files/; }
I have a similar config for my Django sites, but 2 I think you want to use alias
instead of root
for 1 your media. For example:
location /static {
alias /home/user/www/oil/oil_database/static_files;
}
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.