client intended to send too large body

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

client intended to send too large body

文章 yehlu »

http://websistent.com/fix-client-intend ... inx-error/

I recently encountered this error on this WordPress installation running on nginx webserver. I tried to upload a file of size 1.14MB for the article download vmnetcfg.exe when WordPress displayed “HTTP error” in red. I thought it was a problem with either PHP’s max_execution_time or max_upload_filesize directives, but modifying them did not solve the problem. Taking a look at the PHP error log I couldn’t find anything helpful. Finally I saw nginx’s error log which contained this error.

The nginx error log located at /var/log/nginx/error.log contained the following line

[error] 31354#0: *10899 client intended to send too large body: 1198151 bytes, client: <IP address>, server: example.com, request: “POST /wp-admin/async-upload.php HTTP/1.1”, host: “example.com”, referrer: “http://example.com/wp-admin/post.php?post=<post id>&action=edit”
From this error we can understand that an attempt to upload a file using POST method was made which ended up with the error “client intended to send too large body” to fix this a nginx directive named client_max_body_size has to be created/modified. Open the nginx configuration file

vi /etc/nginx/nginx.conf

add or modify the following line inside http {…}

代碼: 選擇全部

client_max_body_size 20M;
then reload nginx

service nginx reload

This will allow file uploads with sizes upto 20MB, the default value of this directive is 1M which is the reason why this error occurs. Alternatively this directive can be used inside the server {…} or location{…} contexts if you want this setting to apply only to a particular vhost or location.
回覆文章

回到「nginx」