WPCloud Deploy Documentation

Fixing Error 413: REQUEST ENTITY TOO LARGE

Sometimes when doing large migrations or other activities involving large file uploads, you’ll run into an error message #413 from the web server: REQUEST ENTITY TOO LARGE.

You can attempt to fix this by changing options in your NGINX and PHP configuration files

NGINX CHANGES

Update the client_max_body_size in your nginx configuration files – from 25M (default) to something larger such as 100M or 250MB.

To do this you will need to ssh into your server:

Once you’re in:

  • Go to the /etc/nginx/sites-enabled folder:
    • cd /etc/nginx/sites-enabled
  • In there are a series of files for each of your domain.  Edit the one for your domain using the NANO editor:
    • nano yourdomain.com
  • About 14 lines down you’ll see the entry for client_max_body_size. Change it to whatever you want.
  • Use the CTRL-O key combination to save the file.
  • Use the CTRL-X  key combination to exit the editor.
  • Restart the nginx web server with:
    • service nginx restart"

PHP.INI CHANGES

Update the post_max_size entry in your php.ini file – from 25M (default) to something larger such as 100M or 250MB.  You can do this from the WPCD site admin screen under the PHP tab.  However, since you might already be in the server, you can change it from the command line as well:

  • Go to the /etc/php/7.4/fpm folder (assuming you’re using PHP 7.4):
    • cd /etc/php/7.4/fpm
  • Edit the PHP.INI file using the NANO editor:
    • nano php.ini
      
  • Scroll down until you see the post_max_size  entry (or use the CTRL-W key combination to enter a search term.)
  • Change its assigned value from 25M to something larger.
  • Use the CTRL-O key combination to save the file.
  • Use the CTRL-X  key combination to exit the editor.
  • Restart the PHP service – stop and start with the following two commands:
    • systemctl stop php7.4-fpm
    • systemctl start php7.4-fpm

Third Party Resources

From Key CDN: Fixing 413 Request Entity Too Large Errors


 

Share: