dthdlv9777
2017-05-05 00:26
浏览 241
已采纳

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

System OS:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS

I have installed a LEMP stack:

nginx/1.10.0 (Ubuntu)
MySQL 5.7.18-0ubuntu0.16.04.1
PHP 7.0.15-0ubuntu0.16.04.4

The system is hanging and displaying a 'connection reset' error message in the browser when I try to upload a theme or a plugin.

I have managed to install some plugins from the Wordpress repository, but I can not install a 15MB plugin I am uploading via a zip from my remote machine via the browser.

I have increased the memory limit to 512mb by editing /etc/php/7.0/fpm/php.ini and the php.ini script is now reporting this is taking effect:

memory_limit    512M    512M

I have also increased the max memory limit in wp-config.php

by inserting this as the first line in the file:

define('WP_MEMORY_LIMIT', '512M');

I have also created the following settings in the php config file at /etc/php/7.0/fpm/php.ini:

max_execution_time = 240
max_input_time = 240
upload_max_filesize = 100M

Yet plugins or themes are still not uploading.

I have tried both Firefox and Chrome.

In Chrome, you get a % complete while the zip is being uploaded. The upload gets to 44% and then crashes, and I get the 'Connection Reset' error in the browser.

I have changed ownership of the plugin directory and wp-content directory to www-data:www-data.

I don't know what else to try, any ideas?

图片转代码服务由CSDN问答提供 功能建议

系统操作系统:

  DISTRIB_ID = Ubuntu 
DISTRIB_RELEASE = 16.04  
DISTRIB_CODENAME = xenial 
DISTRIB_DESCRIPTION =“Ubuntu 16.04.2 LTS 
   
 
 

我安装了LEMP堆栈:

  nginx / 1.10.0(Ubuntu)
MySQL 5.7.18-0ubuntu0.16.04.1 
PHP 7.0.15-0ubuntu0.16.04.4 
   
 
 

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

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

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

  memory_limit 512M 512M 
   
 
 

我还通过insertin增加了 wp-config.php

中的最大内存限制 g这是文件中的第一行:

  define('WP_MEMORY_LIMIT','512M'); 
   
 
 < 我还在php配置文件的 /etc/php/7.0/fpm/php.ini 中创建了以下设置: 
 
 
  max_execution_time  = 240 
max_input_time = 240 
upload_max_filesize = 100M 
   
 
 

然而,插件或主题仍未上传。

我尝试过Firefox和Chrome。

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

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

我不知道还有什么可以尝试,任何想法?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doushi4864 2017-05-05 04:01
    已采纳

    I have the same problem and solve it by editing my htaccess, and it looks like this:

     # BEGIN WordPress
     <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase /
    
     RewriteRule ^index\.php$ - [L]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . /index.php [L]
     </IfModule>
    
    # END WordPress
        # WP Maximum Execution Time Exceeded
        <IfModule mod_php7.c>
        php_value max_execution_time 300
    
        php_value upload_max_filesize 50M
        php_value post_max_size 80M
        php_value max_input_time 300
    
    </IfModule>
        php_value max_execution_time 3000
    </IfModule> 
    
    1. Install the plugin "WP Maximum Execution Time Exceeded" (It will help your files not breaking when uploading)
    2. Then only add this part at the end of the htaccess:

      # WP Maximum Execution Time Exceeded
      <IfModule mod_php7.c>
      php_value max_execution_time 300
      
      php_value upload_max_filesize 50M
      php_value post_max_size 80M
      php_value max_input_time 300
      
      </IfModule>
          php_value max_execution_time 3000
      </IfModule> 
      

      Of course you can also change the numbers!

    That helped me! Hope will help you also!

    Atanas

    已采纳该答案
    打赏 评论
  • douyi3307 2017-05-06 21:07

    As Atanas suggested in the answer posted for Apache, the problem was maximum file upload size in the web-server config.

    To resolve the error in NGINX, I placed the following in the server block:

    client_max_body_size 100M;
    

    (adjust to the size of your desired max upload size as required).

    For example here is the full NGINX config I am running, with the above variable set:

    {
        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;
        }
    
    
    }
    
    打赏 评论

相关推荐 更多相似问题