解决Nginx错误信息:client intended to send too large body

在一台nginx搭建的网站上传图片时出错,提示以下错误信息:

2018/05/14 01:23:32 [error] 591#0: *4896 client intended to send too large body: 1557469 bytes, client: 162.158.255.117, server: itkylin.com, request: “POST /admin/async-upload.php HTTP/1.1”, host: “www.itkylin.com”, referrer: “https://www.itkylin.com/client-intended-…d-too-large-body.html”

网上查了一下,原来是nginx设置的问题,按如下操作即可解决:

一、编辑nginx.conf配置文件:
[email protected]:~# vi /etc/nginx/nginx.conf
#在http{}段落增加如下参数(add or modify the following line inside http {…}):
client_max_body_size 20M;

二、重新启动nginx服务(then reload nginx)
[email protected]:~# service nginx restart

重新上传图片,没有错误提示了,问题解决!