Reputation: 8992
I'm trying to deploy my django project. In my django settings, static file settings are like this:
STATIC_URL = '/static/'
STATIC_ROOT = '/root/www/static'
so my static files are in /root/www/static directory, i can see them in the server. My nginx server block is like this:
server{
listen 80;
location /static/ {
root /root/www;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
when i browse my application with browser, i'm getting
403 - Forbidden
error for static files.
Upvotes: 1
Views: 1799
Reputation: 3386
The problem seems to be with user permissions. You need to change the path that is accessible by the user for which the app is deployed.
The location should look something like this:
location /static {
alias /home/ubuntu/srv/webapps/[app_name]/static;
}
Try this tutorial for more help.
Upvotes: 0
Reputation: 599480
You shouldn't put the static files under /root
: that's for files accessible via the root user only.
Upvotes: 4