Django+nginx+uwsgi静态文件permission denied!

把项目部署到服务器上之后,没有样式,静态文件没有找到。

通过查看nginx的错误日志,发现nginx请求的静态文件提示“permission denied”

意识就是没有权限,查找资料,发现修改nginx.conf的配置可以解决问题。

(env) [root@ nginx]# cat nginx.conf

user root; 默认是nginx,改成root就可以了。
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}

posted @ 2018-09-03 14:57  青花メ  阅读(307)  评论(0编辑  收藏  举报