为什么在Ubuntu上载Wordpress插件或主题时重置连接

Gar*_*ary 3 php wordpress ubuntu nginx

系统操作系统:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS
Run Code Online (Sandbox Code Playgroud)

我已经安装了LEMP堆栈:

nginx/1.10.0 (Ubuntu)
MySQL 5.7.18-0ubuntu0.16.04.1
PHP 7.0.15-0ubuntu0.16.04.4
Run Code Online (Sandbox Code Playgroud)

当我尝试上传主题或插件时,系统正在挂起并在浏览器中显示“连接重置”错误消息。

我已经设法从Wordpress存储库中安装了一些插件,但是无法安装要通过浏览器从远程计算机通过zip上传的15MB插件。

我通过编辑将内存限制增加到512mb,/etc/php/7.0/fpm/php.ini并且php.ini脚本现在报告这已生效:

memory_limit    512M    512M
Run Code Online (Sandbox Code Playgroud)

我还增加了最大内存限制 wp-config.php

通过将其作为文件的第一行插入:

define('WP_MEMORY_LIMIT', '512M');
Run Code Online (Sandbox Code Playgroud)

我还在php配置文件中创建了以下设置/etc/php/7.0/fpm/php.ini

max_execution_time = 240
max_input_time = 240
upload_max_filesize = 100M
Run Code Online (Sandbox Code Playgroud)

但是,插件或主题仍未上传。

我曾经尝试过Firefox和Chrome。

在Chrome浏览器中,上传zip时会获得%的完成度。上传达到44%,然后崩溃,并且在浏览器中收到“连接重置”错误。

我将插件目录和wp-content目录的所有权更改为 www-data:www-data

我不知道还能尝试什么,有什么想法吗?

Gar*_*ary 5

正如Atanas在为Apache发布的答案中所建议的那样,问题在于Web服务器配置中的最大文件上传大小。

为了解决NGINX中的错误,我在服务器块中放置了以下内容:

client_max_body_size 100M;
Run Code Online (Sandbox Code Playgroud)

(根据需要调整为所需的最大上传大小)。

例如,这是我正在运行的完整NGINX配置,并设置了以上变量:

{
    listen 80 default_server;
    listen [::]:80 default_server;

    client_max_body_size 100M;

    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name xxx.xxx.xx.xxx;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }


}
Run Code Online (Sandbox Code Playgroud)