Nginx request entity too large

wordpress
nginx
website
Category Software and digital electronics / IT
2023-11-02 07:22

When I upload a large wordpress theme, I will face with an Nginx error:

request entity too large

How to resolve that?

Answered by ernest1
2024-06-02 08:03

To solve this problem, increase your nginx max upload size.

Fist, open your nginx config file:

sudo nano /etc/nginx/nginx.conf

Then, add the following line into the http block:

client_max_body_size 100M;

You will also need to save your nginx setting changes:

sudo systemctl restart nginx

It might not be enough as you may also hit the PHP limitation too. Such as this error:

The link you followed has expired.

Please try again.

So, you need to increase PHP upload and post size. First, open your php.ini setting file:

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

Then, add the edit the following lines:

upload_max_filesize = 20M
post_max_size = 20M

And do not forget to reload your PHP setting changes:

sudo  systemctl restart php8.3-fpm.service
×

Login

No account?
Terms of use
Forgot password?