Skip to content
  • Quick Ref
  • Contact
  • About
wpcanyon.com

wpcanyon.com

Tag: Nginx

413 Request Entity Too Large on media upload (Nginx/Apache)

Posted on August 19, 2025August 19, 2025 By Admin No Comments on 413 Request Entity Too Large on media upload (Nginx/Apache)

413 Request Entity Too Large on Media Upload (Nginx/Apache)

If you encounter the 413 Request Entity Too Large error when uploading media files to WordPress, it means your server is rejecting files that exceed its configured size limits. This is a common issue that can be quickly fixed by adjusting server settings.

Quick Fix

  1. For Nginx, increase the client_max_body_size directive.
  2. For Apache, increase the LimitRequestBody directive.
  3. Restart or reload your web server to apply changes.

Why This Happens

Web servers limit the size of HTTP request bodies to protect against resource exhaustion and abuse. When uploading large files, if the file size exceeds these limits, the server responds with a 413 error, blocking the upload. WordPress itself also has upload size limits, but this error originates from the web server before WordPress processes the file.

Step-by-step Fix per Server

1. Fix for Nginx

The client_max_body_size directive controls the maximum allowed size of the client request body, which includes file uploads.

  1. Open your Nginx configuration file. This is usually located at:
    • /etc/nginx/nginx.conf
    • or inside your site-specific config in /etc/nginx/sites-available/
  2. Find the http, server, or location block where you want to set the limit.
  3. Add or update the directive, for example to allow 64MB uploads:
client_max_body_size 64M;
  1. Save the file and test the configuration:
sudo nginx -t
  1. If the test is successful, reload Nginx:
sudo systemctl reload nginx

2. Fix for Apache

Apache uses the LimitRequestBody directive to limit the size of the HTTP request body.

  1. Open your Apache configuration file or your site’s .htaccess file. Common locations:
    • /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf
    • Or inside your site root’s .htaccess
  2. Add or update the directive inside the appropriate context (e.g., <Directory> or globally):
LimitRequestBody 67108864

This example sets the limit to 64MB (64 * 1024 * 1024 bytes).

  1. Save the file.
  2. Restart Apache to apply changes:
sudo systemctl restart apache2
# or on CentOS/RHEL
sudo systemctl restart httpd

3. Verify WordPress PHP Upload Limits

Even after adjusting server limits, PHP settings can restrict upload size. Check and update these values in your php.ini or via your hosting control panel:

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 128M

Restart PHP-FPM or your web server if needed.

Works on

Server Control Panel Applicable Directives
Nginx cPanel, CloudPanel, Plesk, Custom client_max_body_size
Apache cPanel, CloudPanel, Plesk, Custom LimitRequestBody, php.ini upload limits

FAQ

Q: How do I know if the 413 error is caused by Nginx or Apache?
A: Check your server stack. If you use Nginx as a reverse proxy in front of Apache, both may have limits. Start by increasing Nginx’s client_max_body_size. If only Apache is used, adjust LimitRequestBody.
Q: Can I set these limits in WordPress instead?
A: WordPress settings like upload_max_filesize and post_max_size in PHP control upload limits, but the 413 error is a server-level rejection. You must increase server limits first.
Q: What if I don’t have access to the server config files?
A: Contact your hosting provider to increase upload size limits or use their control panel if available. Some hosts allow changing PHP and server limits via cPanel or Plesk interfaces.
Q: Will increasing these limits affect server security?
A: Larger limits allow bigger uploads but can increase resource usage and risk of abuse. Set limits according to your site’s needs and monitor server performance.
Q: After changing the limits, the error persists. What else can I check?
Clear your browser cache, restart your web server and PHP services, and verify PHP upload limits. Also, check for any reverse proxies or firewalls that might impose their own limits.
…
Fixes & Errors

Recent Posts

  • Top WordPress Themes for Blogs in 2025
  • WordPress Admin Panel Trick: Adding ID Field to the Posts Listing
  • Solution previous_posts_link and next_posts_link Not Working
  • Show Top Commentators in WordPress Without a Plugin
  • How to Style Admin Comments in WordPress

Recent Comments

    Archives

    • August 2025

    Categories

    • Admin & Blocks
    • Admin & UI
    • Automation
    • Automation & Plugins
    • Comments
    • Comparisons
    • Database & Revisions
    • Developer Snippets
    • Fixes & Errors
    • Media & Thumbnails
    • Queries & Pagination
    • Security
    • Speed & Security
    • Tips & Tricks
    • WooCommerce How‑tos
    • WordPress Snippets
    • WordPress Themes
    • Terms & Conditions
    • Affiliate Disclosure

    Copyright © 2025 wpcanyon.com.

    Powered by PressBook WordPress theme

    Also by the maker of MySurveyReviews.com