WordPress 413 Request Entity Too Large

Go to nginx.conf

sudo nano /etc/nginx/nginx.conf

Add the following line:

client_max_body_size 100M;

in http section as highlighted below:

Restart nginx

sudo systemctl restart nginx

Get the PHP version installed on your machine

 php --version

Get the major version (7.4 for example) out of the info from the above output.

Run the following command to edit php.ini file:

sudo nano /etc/php/7.4/fpm/php.ini

Above, 7.4 is the version of php. Edit the following line to increase limit:

post_max_size = 100M

upload_max_filesize = 100M

Restart PHP

sudo systemctl restart php7.4-fpm

Restart nginx

sudo systemctl restart nginx