解决nginx无法下载大文件,解决open()failed 问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决nginx无法下载大文件,解决open()failed 问题相关的知识,希望对你有一定的参考价值。

解决open()failed (13: Permission denied) while reading upstream的问题

前言:

[[email protected] nginx]# ps -ef|grep nginx
root      1686     1  0  2018 ?        00:00:00 nginx: master process /xxdata/nginx/sbin/nginx
nginx     5443  5442  0  2018 ?        00:00:33 php-fpm: pool www
nginx     5444  5442  0  2018 ?        00:00:34 php-fpm: pool www
nginx    17130  1686  0 15:19 ?        00:00:00 nginx: worker process
root     17517 17228  0 15:31 pts/4    00:00:00 grep --color=auto nginx

出现问题:
网站页面出现异常,无法下载大文件。

查看nginx的error.log日志

2019/01/27 15:18:30 [crit] 23475#0: *39947969 open() "/xxdata/nginx/proxy_temp/4/44/0000200444" failed (13: Permission denied) while reading upstream, client: 110.70.240.98, server: api.xuexintest.com, request: "GET /training-srv/jy/report/downLoad/273e658b-d6a9-45ad-bdf5-893fcd261700?fileType=0&kd=1&zt=1&fx=1&jd=1&dp=1&ly=1&kdkp=1&subjectCode=chemistry&xnID=sjl HTTP/1.1", upstream: "http://10.17.16.104:1300/training-srv/jy/report/downLoad/273e658b-d6a9-45ad-bdf5-893fcd261700?fileType=0&kd=1&zt=1&fx=1&jd=1&dp=1&ly=1&kdkp=1&subjectCode=chemistry&xnID=sjl", host: "ai.test.com"

分析问题及解决方法:
分析问题:
出错原因是work进程没有打开/xxdata/nginx/proxy_temp/4/03/0000000034 文件的权限。work进程属于nginx用户组,nginx用户名。因此只要把proxy_temp 目录权限赋给nginx用户组,nginx用户名就可以了。
解决问题:

[[email protected] nginx]# chown -R nginx:nginx ./proxy_temp/
  [[email protected] nginx]# ll proxy_temp/
 total 40
drwx------ 102 nginx nginx 4096 Mar  9  2016 0
drwx------ 102 nginx nginx 4096 Mar  9  2016 1
drwx------ 102 nginx nginx 4096 Mar  9  2016 2
drwx------ 102 nginx nginx 4096 Mar  9  2016 3
drwx------ 102 nginx nginx 4096 Mar  9  2016 4
drwx------ 102 nginx nginx 4096 Mar  9  2016 5
drwx------ 102 nginx nginx 4096 Mar  9  2016 6
drwx------ 102 nginx nginx 4096 Mar  9  2016 7
drwx------ 102 nginx nginx 4096 Mar  9  2016 8
drwx------ 102 nginx nginx 4096 Mar  9  2016 9

以上是关于解决nginx无法下载大文件,解决open()failed 问题的主要内容,如果未能解决你的问题,请参考以下文章

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid

解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误

解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid

解决nginx和php使用ckfinder无法上传大文件的问题

解决nginx和php使用ckfinder无法上传大文件的问题