Nginx is throwing an 403 Forbidden on Static Files

CodeTalk

I have a django app, python 2.7 with gunicorn and nginx.

Nginx is throwing a 403 Forbidden Error, if I try to view anything in my static folder @:

/home/ubuntu/virtualenv/myapp/myapp/homelaunch/static

nginx config(/etc/nginx/sites-enabled/myapp) contains:

server {
        listen       80;
        server_name     *.myapp.com;
        access_log /home/ubuntu/virtualenv/myapp/error/access.log;
        error_log /home/ubuntu/virtualenv/myapp/error/error.log warn;
        connection_pool_size 2048;

        fastcgi_buffer_size 4K;
        fastcgi_buffers 64 4k;

        root /home/ubuntu/virtualenv/myapp/myapp/homelaunch/;

        location /static/ {
            alias /home/ubuntu/virtualenv/myapp/myapp/homelaunch/static/;
        }

        location / {
            proxy_pass http://127.0.0.1:8001;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
        }
    }

error.log contains:

2013/11/24 23:00:16 [error] 18243#0: *277 open() "/home/ubuntu/virtualenv/myapp/myapp/homelaunch/static/img/templated/home/img.png" failed (13: Permission denied), client: xx.xx.xxx.xxx, server: *.myapp.com, request: "GET /static/img/templated/home/img2.png HTTP/1.1", host: "myapp.com", referrer: "http://myapp.com/"

access.log contains

xx.xx.xx.xxx - - [24/Nov/2013:23:02:02 +0000] "GET /static/img/templated/base/animg.png HTTP/1.1" 403 141 "http://myapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:25.0) Gecko/20100101 Firefox/25.0"
xx.xx.xx.xxx - - [24/Nov/2013:23:02:07 +0000] "-" 400 0 "-" "-"

I tried just viewing say a .css file in /static/ and it throws an error like this in source:

<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.1.19</center>
</body>
</html>
bryn

It appears the user nginx is running as (nginx?) is missing privileges to read the local file /home/ubuntu/virtualenv/myapp/myapp/homelaunch/static/img/templated/home/img.png. You probably wanna check file permissions as well as permissions on the directories in the hierarchy.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

nginx+django+uwsgi static files 403 Forbidden

From Java

Nginx serve static file and got 403 forbidden

From Dev

Why am I getting 403 Forbidden status codes for static files served via nginx / php-fpm?

From Dev

403 Forbidden nginx when trying to run simple static html

From Dev

nginx 403 Forbidden error

From Dev

403 forbidden error at Nginx

From Dev

FS.Collection throwing 403 Forbidden Errors

From Dev

always 403 Forbidden with Nginx .htpasswd

From Dev

Nginx: 403 Forbidden nginx/1.12.1 (Ubuntu)

From Dev

Django/Nginx - Error 403 Forbidden when serving media files over some size

From Java

Nginx 403 error: directory index of [folder] is forbidden

From Dev

403 Forbidden on nginx/1.4.6 (Ubuntu) - Laravel

From Dev

403 Forbidden on Rails app w/ Nginx, Passenger

From Dev

403 forbidden error, in Nginx configuration for Wordpress site

From Dev

Nginx does not serve image ( 403 - forbidden error )

From Dev

Linode Update - 403 Forbidden with Rails and Passenger Nginx

From Dev

403 Forbidden nginx/1.6.2 on Laravel Homestead installation

From Dev

Nginx config issue: getting 403 Forbidden

From Dev

403 forbidden error, in Nginx configuration for Wordpress site

From Dev

Nginx from source, return 403 Forbidden

From Dev

Nginx 403 Forbidden error on a simple conf file

From Dev

CentOS, Nginx: 403 Forbidden in Laravel's folder

From Dev

Jersey ContainerRequestFilter: Getting 404 after throwing 'abortWith' with status forbidden (403)

From Dev

NGINX cache static files

From Dev

Static files setting in Nginx?

From Dev

NGINX cache static files

From Dev

Google Static map without api key gives 403(forbidden) error

From Dev

403 Forbidden: Nginx not serving statics in Django Admin panel

From Dev

Nginx: Why the index directive can't work, 403 forbidden?

Related Related

  1. 1

    nginx+django+uwsgi static files 403 Forbidden

  2. 2

    Nginx serve static file and got 403 forbidden

  3. 3

    Why am I getting 403 Forbidden status codes for static files served via nginx / php-fpm?

  4. 4

    403 Forbidden nginx when trying to run simple static html

  5. 5

    nginx 403 Forbidden error

  6. 6

    403 forbidden error at Nginx

  7. 7

    FS.Collection throwing 403 Forbidden Errors

  8. 8

    always 403 Forbidden with Nginx .htpasswd

  9. 9

    Nginx: 403 Forbidden nginx/1.12.1 (Ubuntu)

  10. 10

    Django/Nginx - Error 403 Forbidden when serving media files over some size

  11. 11

    Nginx 403 error: directory index of [folder] is forbidden

  12. 12

    403 Forbidden on nginx/1.4.6 (Ubuntu) - Laravel

  13. 13

    403 Forbidden on Rails app w/ Nginx, Passenger

  14. 14

    403 forbidden error, in Nginx configuration for Wordpress site

  15. 15

    Nginx does not serve image ( 403 - forbidden error )

  16. 16

    Linode Update - 403 Forbidden with Rails and Passenger Nginx

  17. 17

    403 Forbidden nginx/1.6.2 on Laravel Homestead installation

  18. 18

    Nginx config issue: getting 403 Forbidden

  19. 19

    403 forbidden error, in Nginx configuration for Wordpress site

  20. 20

    Nginx from source, return 403 Forbidden

  21. 21

    Nginx 403 Forbidden error on a simple conf file

  22. 22

    CentOS, Nginx: 403 Forbidden in Laravel's folder

  23. 23

    Jersey ContainerRequestFilter: Getting 404 after throwing 'abortWith' with status forbidden (403)

  24. 24

    NGINX cache static files

  25. 25

    Static files setting in Nginx?

  26. 26

    NGINX cache static files

  27. 27

    Google Static map without api key gives 403(forbidden) error

  28. 28

    403 Forbidden: Nginx not serving statics in Django Admin panel

  29. 29

    Nginx: Why the index directive can't work, 403 forbidden?

HotTag

Archive