WorkPress Nginx: 413 – Request Entity Too Large Error

错误原因:Nginx和PHP默认配置限制了上传文件大小。

解决方法:

1、修改Nginx配置

vi /etc/nginx/nginx.conf

# set client body size to 2M #
client_max_body_size 20M;

2、修改PHP配置

vi /etc/php.ini

;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M

;The maximum size of an uploaded file.
upload_max_filesize = 10M

;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

然后重启PHP和Nginx

sudo systemctl restart php-fpm

sudo systemctl restart nginx.service

你可能感兴趣的:(WordPress,nginx,php,wordpress)