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

为什么在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?

  • 写回答

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?