解决nginx无法下载大文件问题

guiyun affiliate

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

image.png

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

查看nginx的error.log日志

020/01/21 11:57:59 [crit] 6561#0: *539 open() "/usr/local/nginx/proxy_temp/4/10/0000000104" failed (13: Permission denied) while reading upstream, client: 112.96.135.188, server: zimg.suwenini.com, request: "GET /img/c7d995212035d846228dc76db50e5c1c HTTP/1.1", upstream: "http://172.31.203.135:4869/c7d995212035d846228dc76db50e5c1c", host: "zimg.suwenini.com"

2020/01/21 11:59:45 [emerg] 6699#0: invalid number of arguments in "client_max_body_size" directive in /usr/local/nginx/conf/vhost/sw.conf:142

2020/01/21 12:01:58 [crit] 6772#0: *6 open() "/usr/local/nginx/proxy_temp/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 112.96.135.188, server: zimg.suwenini.com, request: "GET /img/c7d995212035d846228dc76db50e5c1c HTTP/1.1", upstream: "http://172.31.203.135:4869/c7d995212035d846228dc76db50e5c1c", host: "zimg.suwenini.com"

2020/01/21 12:02:21 [crit] 6770#0: *21 open() "/usr/local/nginx/proxy_temp/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: 112.96.135.188, server: zimg.suwenini.com, request: "GET /img/c7d995212035d846228dc76db50e5c1c HTTP/1.1", upstream: "http://172.31.203.135:4869/c7d995212035d846228dc76db50e5c1c", host: "zimg.suwenini.com"

2020/01/21 12:02:33 [crit] 6772#0: *32 open() "/usr/local/nginx/proxy_temp/3/00/0000000003" failed (13: Permission denied) while reading upstream, client: 112.96.135.188, server: zimg.suwenini.com, request: "GET /img/c7d995212035d846228dc76db50e5c1c HTTP/1.1", upstream: "http://172.31.203.135:4869/c7d995212035d846228dc76db50e5c1c", host: "zimg.suwenini.com"

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

# chown -R ww:ww  /usr/local/nginx/proxy_temp/
# ll proxy_temp/

    image.png

    guiyun affiliate

    作者头像
    南宫俊逸创始人

    君子好学,自强不息~

    上一篇:删除以前版本的 Windows
    下一篇:卡通插画设计商务市场营销公司整站模板(英文)

    相关推荐

    4

    发表评论