此文章发布于73个月前,部分信息可能已经过时,请自行斟酌确认。
最近使用 NextCloud 搭建了一个私人云网盘,上传部分图片时提示上传失败,经分析上传失败的图片是超过上传限制造造成的。
修改了 php 的上传限制后没有效果,最后发现是 nginx 的问题。
问题描述
出现问题后查看 nginx 日志文件:/var/log/nginx/error.lgo 发现以下错误日志:
2019/11/14 06:34:43 [error] 1975#1975: *1 client intended to send too large body: 1365581 bytes, client: 192.168.50.1, server: _, request: "PUT /remote.php/webdav/20190001/10.jpg HTTP/1.1", host: "192.168.50.101"
解决方案
修改 nginx 的配置文件 /etc/nginx/nginx.conf 在 http 段加入下面代码
http{
client_max_body_size 20m; # 不要漏了最后一个分号
}重启 nginx
service nginx restart搞定。