Nginx can be set to allow the maximum size of the client request body using client_max_body_size directive. If the size of a request exceeds the configured value, the 413 (Request Entity Too Large) error returned to the client.
You need to configure both nginx and php to allow upload size.
1. Nginx Configuration
To fix this issue edit your nginx.conf. Open the Terminal or login to the remote server using ssh client. Type the following command to edit your nginx.conf using a text editor such as vi or joe or nano:
sudo nano /etc/nginx/nginx.conf
Add the following line to http or server or location context to increase the size limit in nginx.conf
# set client body size to 2M client_max_body_size 2M;
Save and close the file. Restart the Nginx webserver.
sudo systemctl restart nginx
2. PHP configuration
Your php installation also put limits on upload file size. Edit php.ini and set the following directives
;This sets the maximum amount of memory in bytes that a script is allowed to allocate memory_limit = 128M ;The maximum size of an uploaded file. upload_max_filesize = 20M ;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize post_max_size = 30M
Save and close the file. Restart the PHP-FPM.
sudo systemctl restart php-fpm