nginx error: client intended to send too large body

After moving this site to DigitalOcean‘s cloud environment, I found a problem when uploading a file from my blog posting interface. Looking up from the error log, it says "client intended to send too large body: 1122400 bytes". I wanted to upload a file larger than 1 MB. I’m using nginx for the web server, and the solution is pretty simple.

Edit /etc/nginx/nginx.conf configuration file, and add client_max_body_size 20M; between http { }. Save the config file and start the nginx. Problem solved. If you need higher value, just change the 20 MB to something higher.