Answer the question
In order to leave comments, you need to log in
How to solve the file access problem?
Hello, I configured everything correctly, set the correct paths, but for some reason a similar error pops up:
nginx settings
server {
listen 80;
server_name IP;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /root/melody;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
[email protected]:~/melody# ls -alah
total 40K
drwxr-xr-x 7 root root 4.0K Sep 29 19:37 .
drwx------ 5 root root 4.0K Sep 29 19:07 ..
-rw-r--r-- 1 root root 0 Sep 29 13:29 __init__.py
-rw-r--r-- 1 root root 663 Sep 29 13:29 manage.py
-rw-r--r-- 1 root root 39 Sep 29 13:29 Procfile
-rw-r--r-- 1 root root 347 Sep 29 13:29 requirements.txt
drwxr-xr-x 4 root root 4.0K Sep 29 14:31 reserveflats
drwxr-xr-x 8 root root 4.0K Sep 29 19:26 static
drwxr-xr-x 2 root root 4.0K Sep 29 19:07 templates
drwxr-xr-x 4 root root 4.0K Sep 29 13:33 venv
drwxr-xr-x 4 root root 4.0K Sep 29 13:52 website
Answer the question
In order to leave comments, you need to log in
Your static is located in the home directory of root, naturally there is no access for anyone.
You need to create a separate user, run the application on his behalf, and from a directory that belongs to him.
mkdir -pv /var/www/username/data/www/site.ru/{static,media} && \
useradd --home-dir /var/www/username/data --user-group www-data && \
chown -R username:www-data /var/www/username && \
chmod g+r /var/www/username
systemctl daemon-reload
and restart the service. sudo -i -u username
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question