[英]Why is the connection reset when uploading Wordpress plugin or theme on Ubuntu
系统OS:
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/fpm/php.ini
将内存限制增加到512mb,而php.ini脚本现在报告它生效了:
memory_limit 512M 512M
我还增加了wp-config.php
的最大内存限制
通过将其插入文件中的第一行:
define('WP_MEMORY_LIMIT', '512M');
我还在/etc/php/7.0/fpm/php.ini
的php配置文件中创建了以下设置:
max_execution_time = 240
max_input_time = 240
upload_max_filesize = 100M
然而,插件或主题仍未上传。
我试过Firefox和Chrome。
在Chrome中,您可以在上传zip时获得完整百分比。 上传达到44%然后崩溃,我在浏览器中收到“连接重置”错误。
我已将插件目录和wp-content目录的所有权更改为www-data:www-data
。
我不知道还有什么可以尝试,任何想法?
正如Atanas在为Apache发布的答案中建议的那样,问题是Web服务器配置中的文件上载大小最大。
为了解决NGINX中的错误,我将以下内容放在服务器块中:
client_max_body_size 100M;
(根据需要调整所需的最大上传大小)。
例如,这里是我运行的完整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;
}
}
我有同样的问题,通过编辑我的htaccess解决它,它看起来像这样:
# 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>
然后只在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>
当然你也可以改变数字!
那对我有帮助! 希望也能帮到你!
阿塔纳斯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.