The client intended to send too large body: bytes error (HTTP 413 Payload Too Large) during aaPanel File Manager uploads occurs when the uploaded file exceeds the maximum allowed request body size enforced by aaPanel’s internal Nginx instance or PHP-FPM settings. aaPanel uses a dedicated reverse proxy and web stack for its admin panel on port 8888, separate from site-specific web server instances. When a user uploads a large file or backup directly through the File Manager interface, the request is rejected at the Nginx layer before reaching the panel’s backend file-handling script.
Quick Fix
Increase the global client_max_body_size directive inside aaPanel’s core Nginx configuration file (/www/server/nginx/conf/nginx.conf) or the panel’s internal web configuration, then reload the web server daemon:
sed -i 's/client_max_body_size .*/client_max_body_size 1024M;/' /www/server/nginx/conf/nginx.conf && systemctl reload nginx
Step-by-Step Resolution
- Modify Global Nginx Configuration: Open the primary Nginx configuration file in a text editor or via terminal:
nano /www/server/nginx/conf/nginx.conf
Locate the http block and add or update the client_max_body_size parameter to match your maximum required file upload threshold (e.g., 2048M or 5G):
http {
include mime.types;
default_type application/octet-stream;
# Increase maximum upload request size
client_max_body_size 2048M;
# Adjust timeout thresholds for large uploads
client_body_timeout 300s;
client_header_timeout 300s;
keepalive_timeout 300s;
send_timeout 300s;
}
- Update aaPanel Internal Panel Settings (If Applicable): If aaPanel runs on its standalone Python/Gunicorn or internal Nginx engine, adjust the panel-level upload limits by editing /www/server/panel/config/config.json or updating the upload limit directly within aaPanel GUI via Settings > Max File Upload Size (set value in MB, e.g.,
2048). - Configure PHP Runtime Upload Restrictions: For file operations executed via PHP-backed web tools, edit the active
php.inifile (e.g., /www/server/php/81/etc/php.ini) to ensure the PHP engine permits matching request sizes:
upload_max_filesize = 2048M
post_max_size = 2048M
memory_limit = 512M
max_execution_time = 600
max_input_time = 600
- Validate Nginx Syntax and Restart Services: Test the Nginx configuration file for structural or syntax errors, then reload Nginx and restart the aaPanel service:
nginx -t && systemctl reload nginx
bt 1 # Restarts aaPanel service
Why This Fails for Some Users
- Editing Site-Specific Nginx Instead of Panel Nginx: Users frequently edit the domain virtual host file (
/www/server/panel/vhost/nginx/yourdomain.conf) instead of the core aaPanel Nginx configuration (/www/server/nginx/conf/nginx.conf). Site-level configuration changes do not affect the aaPanel GUI running on port 8888. - Upstream Cloudflare / Reverse Proxy Edge Limits: If aaPanel is accessed behind Cloudflare, free-tier accounts enforce an unmodifiable 100MB HTTP request body limit (
413 Payload Too Large). Direct IP access or Cloudflare Enterprise is required for uploads larger than 100MB over HTTP/HTTPS. - Temporary Directory Disk Space Exhaustion: Nginx buffers incoming upload payloads exceeding
client_body_buffer_sizeinto temporary files under/var/tmp/nginxor/www/server/nginx/client_body_temp. If the partition hosting these directories runs out of disk space during a multi-gigabyte upload, Nginx aborts the stream and returns an internal error or 413 status. - PHP-FPM
request_terminate_timeoutOverrides: Even ifclient_max_body_sizeandupload_max_filesizeare set correctly, slow connections transferring large files may hit PHP-FPM execution limits, terminating the connection mid-transfer.