Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 errors after install #71

Closed
pieterhouwen opened this issue Apr 9, 2021 · 10 comments
Closed

403 errors after install #71

pieterhouwen opened this issue Apr 9, 2021 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@pieterhouwen
Copy link

After installing I can't access the frontend because I'm getting 403 errors

patrowl

Is this because I cloned the repo in /root ? If so, where should I put the files?

@pieterhouwen
Copy link
Author

Nginx error log:

2021/04/09 07:32:10 [error] 3681#3681: *1 open() "/root/PatrowlHears/backend_app/staticfiles/css/app.05e53b51.css" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/css/app.05e53b51.css HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:10 [error] 3681#3681: *3 open() "/root/PatrowlHears/backend_app/staticfiles/css/chunk-vendors.00404edb.css" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/css/chunk-vendors.00404edb.css HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:12 [error] 3681#3681: *3 open() "/root/PatrowlHears/backend_app/staticfiles/favicon.ico" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/favicon.ico HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:17 [error] 3681#3681: *3 open() "/root/PatrowlHears/backend_app/staticfiles/css/app.05e53b51.css" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/css/app.05e53b51.css HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:17 [error] 3681#3681: *1 open() "/root/PatrowlHears/backend_app/staticfiles/js/app.34a32470.js" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/js/app.34a32470.js HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:17 [error] 3681#3681: *6 open() "/root/PatrowlHears/backend_app/staticfiles/js/chunk-vendors.cb4027c4.js" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/js/chunk-vendors.cb4027c4.js HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:17 [error] 3682#3682: *7 open() "/root/PatrowlHears/backend_app/staticfiles/css/chunk-vendors.00404edb.css" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/css/chunk-vendors.00404edb.css HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:17 [error] 3682#3682: *7 open() "/root/PatrowlHears/backend_app/staticfiles/js/app.34a32470.js" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/js/app.34a32470.js HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:17 [error] 3682#3682: *7 open() "/root/PatrowlHears/backend_app/staticfiles/favicon.ico" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/favicon.ico HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:26 [error] 3682#3682: *7 open() "/root/PatrowlHears/backend_app/staticfiles/css/app.05e53b51.css" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/css/app.05e53b51.css HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:26 [error] 3681#3681: *6 open() "/root/PatrowlHears/backend_app/staticfiles/css/chunk-vendors.00404edb.css" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/css/chunk-vendors.00404edb.css HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:26 [error] 3681#3681: *1 open() "/root/PatrowlHears/backend_app/staticfiles/js/app.34a32470.js" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/js/app.34a32470.js HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:26 [error] 3681#3681: *3 open() "/root/PatrowlHears/backend_app/staticfiles/js/chunk-vendors.cb4027c4.js" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/js/chunk-vendors.cb4027c4.js HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:26 [error] 3681#3681: *3 open() "/root/PatrowlHears/backend_app/staticfiles/js/app.34a32470.js" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/js/app.34a32470.js HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"
2021/04/09 07:32:26 [error] 3681#3681: *3 open() "/root/PatrowlHears/backend_app/staticfiles/favicon.ico" failed (13: Permission denied), client: 192.168.2.147, server: myhears.patrowl.io, request: "GET /static/favicon.ico HTTP/1.1", host: "192.168.2.158:8383", referrer: "http://192.168.2.158:8383/"

@MaKyOtOx
Copy link
Contributor

MaKyOtOx commented Apr 9, 2021

Hello, did you used the Docker-compose ?

@MaKyOtOx
Copy link
Contributor

MaKyOtOx commented Apr 9, 2021

If not try this in the backend:

python manage collectstatic --noinput

and check the /root/PatrowlHears/backend_app/staticfiles/ permissions

@MaKyOtOx MaKyOtOx self-assigned this Apr 9, 2021
@MaKyOtOx MaKyOtOx added the bug Something isn't working label Apr 9, 2021
@pieterhouwen
Copy link
Author

Hello, I used the install.sh script (the updated one). Trying to run the python command gave me this:

root@ubuntu-server:~/PatrowlHears/backend_app# python manage.py collectstatic --noinput
  File "manage.py", line 16
    ) from exc
         ^
SyntaxError: invalid syntax
root@ubuntu-server:~/PatrowlHears/backend_app# python3 manage.py collectstatic --noinput
Traceback (most recent call last):
  File "manage.py", line 10, in main
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 16, in main
    ) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
root@ubuntu-server:~/PatrowlHears/backend_app#

Checking the permissions gave me this:

root@ubuntu-server:~/PatrowlHears/backend_app# cd staticfiles/
root@ubuntu-server:~/PatrowlHears/backend_app/staticfiles# ls -l
total 44
drwxr-xr-x 6 root root  4096 Apr  7 15:50 admin
drwxr-xr-x 2 root root  4096 Apr  7 15:50 css
drwxr-xr-x 5 root root  4096 Apr  7 15:50 drf-yasg
-rw-r--r-- 1 root root 15086 Apr  7 15:50 favicon.ico
drwxr-xr-x 2 root root  4096 Apr  7 15:50 fonts
drwxr-xr-x 2 root root  4096 Apr  7 15:50 img
drwxr-xr-x 2 root root  4096 Apr  7 15:50 js
drwxr-xr-x 7 root root  4096 Apr  7 15:50 rest_framework
root@ubuntu-server:~/PatrowlHears/backend_app/staticfiles# ls -l js
total 6272
-rw-r--r-- 1 root root  308780 Apr  7 15:50 app.34a32470.js
-rw-r--r-- 1 root root 1062233 Apr  7 15:50 app.34a32470.js.map
-rw-r--r-- 1 root root 1085929 Apr  7 15:50 chunk-vendors.cb4027c4.js
-rw-r--r-- 1 root root 3955494 Apr  7 15:50 chunk-vendors.cb4027c4.js.map
root@ubuntu-server:~/PatrowlHears/backend_app/staticfiles#

@MaKyOtOx
Copy link
Contributor

MaKyOtOx commented Apr 9, 2021

OK, try to import the python virtual env before: source env/bin/activate

@pieterhouwen
Copy link
Author

Seemed to work, gave me this:

0 static files copied to '/root/PatrowlHears/backend_app/staticfiles', 233 unmodified.

@MaKyOtOx
Copy link
Contributor

MaKyOtOx commented Apr 9, 2021

OK, it seems you have an issue with the nginx config -> (13: Permission denied)

@pieterhouwen
Copy link
Author

My nginx config file for patrowl:

server {
    listen 8383;
    autoindex on;
    server_name myhears.patrowl.io localhost;

    root .;

    # access_log var/log/nginx.patrowlhears-access.log;
    # error_log var/log/nginx.patrowlhears-error.log;

    location / {
        proxy_pass http://127.0.0.1:8303;

        proxy_set_header X-Real-IP              $remote_addr;
        proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host       $host;
        proxy_set_header Proxy                  "";

        add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
              expires off;

        # Custom headers
        proxy_connect_timeout                   75s;
        proxy_read_timeout                      300s;

        proxy_redirect                          off;
        proxy_buffering                         off;
        proxy_buffer_size                       "4k";
    }

    location /static {
        alias /root/PatrowlHears/backend_app/staticfiles;
    }
    location /media {
        alias /root/PatrowlHears/backend_app/media;
    }
}

@MaKyOtOx
Copy link
Contributor

Still an issue ?

@pieterhouwen
Copy link
Author

No idea what changed, but no, not an issue anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants