Nginx Error Log

2018/11/08 01:53:13 [error] 20476#20476: 12876 open() “/opt/~/media/video/20181108012910_85931.mp4” failed (13: Permission denied), client: 172..., server: , request: “GET /media/video/20181108012910_85931.mp4 HTTP/1.1”, host: “172...:

当前ngixn启动用户对上述文件没有权限
cat /etc/nginx/nginx.conf 
查看nginx配置文件中 user 是否有读取该文件权限 
ps aux | grep "nginx: worker process" | awk '{print $1}'
查看nginx用户

【Here are two solutions】
(1)user root ;
将user改为root,这样就拥有足够的权限对文件操作
(2)user www-data(配置文件中的用户名);
chown -R www-data:www-data /opt/~/media/video/
指定 /opt/~/media/video/目录所有者为www-data
chmod 760  /opt/~/media/video/
赋予local目录读写权限给www-data,别的用户对这个目录没有任何权限。

猜你喜欢

转载自blog.csdn.net/weixin_33127753/article/details/83894609
今日推荐