Fix client intended to send too large body: xyz bytes in Nginx

To fix the error “client intended to send too large body: xyz bytes” in Nginx, you can increase the client_max_body_size value in the Nginx configuration file. The default value is often set to 1MB, but you can increase it to match your needs.

Here’s how you can make the change:

  1. Open the Nginx configuration file using a text editor:
    sudo nano /etc/nginx/nginx.conf
  2. Look for the http block and add or modify the client_max_body_size value:
    http {
    ...
    client_max_body_size 100M;
    ...
    }
  3. Save the file and exit the editor.
  4. Reload Nginx to apply the changes:
    sudo nginx -s reload
  5. Test the changes by making a request that previously caused the error.

Note: The location of the Nginx configuration file may differ based on your distribution and setup. Also, make sure to increase the client_max_body_size value to a reasonable value that meets your needs.

Leave a Comment