Nginx 代理 Node.js 静态文件比较大无法正常显示,关键词 proxy_temp Permission denied

网站中图片过大无法正常显示,通常显示一半,就提示502错误了,Nginx 错误日志代理提示:

2021/05/19 16:28:35 [crit] 10976#0: *13 open() "/nginx_dir/proxy_temp/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: 200.130.237.38, server: test.com, request: "GET /uploads/images/20210220/48a18881fa3b45781b512f2376c9bef8.gif HTTP/1.1", upstream: "http://127.0.0.1:3001/uploads/images/20210220/48a18881fa3b45781b512f2376c9bef8.gif", host: "www.test.com", referrer: "https://www.test.com/cat/5"


当前nginx的用户是谁

ps aux | grep "nginx: worker process"

然后查看

ll /nginx_dir/proxy_temp


发现一切正常,尝试调整缓存大小限制,无效。


放弃使用node提供静态文件功能,使用nginx 直接托管上传后的静态文件,nginx配置文件中加入:

location /uploads {
  alias /www/test_com/static/uploads;
}


声明:本站所有文章和图片,如无特殊说明,均为原创发布。商业转载请联系作者获得授权,非商业转载请注明出处。
真诚赞赏,手留余香
赞赏
随机推荐
WordPress 使用 shortcode() 增加编辑器功能
WP_REST_Response 返回结果类
MySQL 使用 DATE_FORMAT() 和 FROM_UNIXTIME() 格式化时间
WordPress 后台添加菜单
WordPress 设置菜单
WordPress 调用自定义头像
MySQL 的 sql_mode 模式介绍:为什么 MySQL 中 int,float,double 类型字段插入空字符时自动转为0
ReferenceError: __dirname is not defined in ES module scope