权限被拒绝
错误。请问有人能告诉我我在权限方面做错了什么,以及我应该如何更改?这是我的/var/log/nginx/error.log
,报错信息为:open() "/root/project/static/*.css" failed (13: Permission denied), client: 2xx.xx.xx.xxx, server: _, request: "GET /static/*.css HTTP/1.1", host: "1xx.xx.xx.xxx"
。这是我的nginx site-available config
。server {
listen 80 default_server;
listen [::]:80 default_server;
# root /var/www/html;
# Add index.php to the list if you are using PHP
# index index.html index.htm index.nginx-debian.html;
server_name _;
#location = /favicon.ico { access_log off; log_not_found off; }
#location /media {
# root /root/project/mediafiles;
#}
location ^~ /static/ {
allow all; # this is from one of the posts but no luck
auth_basic off; # this is from one of the posts but no luck
root /root/project;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi/project.sock;
}
}
关于我文件夹权限的问题
对于项目文件夹,它是drwxr-xr-x 23 www-data www-data
对于静态文件夹,它是drwxr-x--- 8 www-data www-data 4096 May 23 14:40 static
我从未将static权限设置为755
,但仍然没有成功。无论如何,这里使用root作为用户,而不是拥有额外用户并且root也在www-data
组中。
非常感谢您提供的所有帮助。
编辑:
根据建议,以下是ps aux | grep nginx
的输出
root 810 0.0 0.0 124972 1440 ? Ss 02:18 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 811 0.0 0.0 125688 4840 ? S 02:18 0:00 nginx: worker process
www-data 812 0.0 0.0 125348 3196 ? S 02:18 0:00 nginx: worker process
root 1159 0.0 0.0 14224 1004 pts/0 S+ 04:25 0:00 grep --color=auto nginx
ps aux | grep nginx
并分享结果。 - rtindru