← Catalog Matrix

Deployment Execution Blueprint

---
title: Fixing Nginx 413 Request Entity Too Large Errors Permanently
description: A quick triage guide to override client maximum body size restrictions in Nginx to allow large file uploads and payload requests.
category: Server Configuration
slug: fixing-nginx-client-intended-to-send-too-large-body
keywords: nginx 413 request entity too large, client_max_body_size nginx, nginx client intended to send too large body, allow large uploads nginx, fix wordpress upload limit nginx
---

Technical Context & Blueprints
When a web application throws an HTTP 413 Request Entity Too Large error, or when Nginx error logs output client intended to send too large body, the server's security isolation gate is actively blocking an upload. By default, Nginx restricts file upload sizes to a hyper-strict limit of 1 Megabyte to prevent memory exhaustion Denial of Service (DoS) attacks.

To allow large uploads (like media files, heavy PDFs, or massive JSON payloads), you must explicitly adjust the data tracking thresholds inside your web server configurations.

Nginx Global vs. Virtual Host Configuration
Open your main configuration context (/etc/nginx/nginx.conf) or your site-specific configuration block. Inject the client_max_body_size directive into the appropriate block context depending on how widely you want the exception applied:

# APPROACH A: Apply globally across ALL websites hosted on this machine
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # Elevate maximum payload limit to 100 Megabytes globally
    client_max_body_size 100M;
}

# APPROACH B: Apply strictly to a specific standalone application routing block
server {
    listen 8443 ssl http2;
    server_name api.howtodocument.com;

    # Overrides global settings specifically for your API routes
    client_max_body_size 100M;

    location /api/v1/uploads {
        proxy_pass http://127.0.0.1:8000;
        
        # Optional: Ensure backend read buffers don't choke during high-speed data stream ingestions
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;
    }
}

# Verify configuration syntax properties before soft-restarting the engine
sudo nginx -t

# Apply configuration changes smoothly without dropping active customer websocket sessions
sudo systemctl reload nginx