Nginx 413 Request Entity Too Large

by lifeLinux on August 26, 2011

I’m currently running web server using Nginx. And when i try to upload file more than 1M, i got Nginx error 403: Request entity too large. How do I fix this problem and allow file upload upto 2MB in size?

client_max_body_size 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, type the following command as root

# vi /usr/local/nginx/conf/nginx.conf

Add client_max_body_size in http section

http {
    ....
    client_max_body_size 2M;
    ....
}

Save and close the file. Reload the nginx, type the following command

# /usr/local/nginx/sbin/nginx -s reload

Related Posts:

Previous post:

Next post: