在Wordpress后台安装插件时,选择从本地电脑上传插件。提交后页面提示如下错误:

413 Request Entity Too Large
/wp:paragraph

1.修改Nginx的配置文件

vim /etc/nginx/conf.d/abc.cn.conf
server {
    listen         80 default_server;
    listen         [::]:80 default_server;
    server_name    abc.cn;
    root           /var/www/abc.cn;
    index          index.html;
    client_max_body_size    200m;
    location / {
      index index.php index.html index.htm;
      try_files $uri $uri/ =404;
    }
    location ~* \.php$ {
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}

2.修改PHP.ini

vim /etc/php.ini
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 200M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

3.重启php-fpm和Nginx

systemctl restart nginx
systemctl restart php-fpm

0 Comments

发表评论

电子邮件地址不会被公开。 必填项已用*标注