Nginx: 413 Request Entity Too Large Error and Solution


I'm running nginx as a frond end to php based Apache+mod_fastcgi server. My app lets user upload images upto 2MB in size. When users trying to upload 1.5MB+ size image file using nginx reverse proxy, they are getting the following error on screen:

Nginx 413 Request Entity Too Large

How do I fix this problem and allow image upload upto 2MB in size?

The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request. If size is greater the given one, then the client gets the error "Request Entity Too Large" (413). To fix this issue edit your nginx.conf, enter:
# vi /usr/local/nginx/conf/nginx.conf
Add the following to increase the size limit in nginx.conf, enter:

 
client_max_body_size 2M;
 

Save and close the file. Reload the nginx webserver, enter:
# /usr/local/nginx/sbin/nginx -s reload

Last update:
2013-07-15 13:30
Author:
Igor
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.