Static file can't serve via nginx. I didn't found any answer for this question so please help me to figure out.
settings.py
DEBUG = False
/etc/nginx/sites-available/example.com
upstream test {
server 127.0.0.1:8000;
keepalive 500;
}
server {
listen 80;
server_name example.com;
client_max_body_size 4G;
location /static/ {
alias /home/user/live/staticfiles/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://test;
}
}
cat /var/log/nginx/error.log shows me below output
2015/01/20 05:43:07 [error] 4480#0: *7 open() "/home/user/live/staticfiles/images/footer-logo.png" failed (13: Permission denied), client: 182.74.206.202, server: example.com, request: "GET /static/images/footer-logo.png HTTP/1.1", host: "example.com", referrer: "example.com/"
Update :
I just say it's not working ... Still getting same error i can't believe this happening because of file permission issue. I included below detail...
[myuserm@instance-4 home]$ namei -om /home/myuser/live/staticfiles/js/jquery.fancybox.js
f: /home/myuser/live/staticfiles/js/jquery.fancybox.js
dr-xr-xr-x root root /
drwxr-xr-x root root home
drwxrwxrwx myuser myuser myuser
drwxrwxrwx root root live
drwxrwxrwx myuser myuser staticfiles
drwxrwxrwx myuser myuser js
-rwxrwxrwx myuser myuser jquery.fancybox.js