【问题标题】:NGINX 413 Error: Upload large files in Wordpress (HTTP Error)NGINX 413 错误:在 Wordpress 中上传大文件(HTTP 错误)
【发布时间】:2020-02-04 18:32:43
【问题描述】:

我试图将 MP4 文件上传到 Wordpress 媒体,但 413 错误停止了我。我生命的极限(在这个不朽的 bug 中)是 100mb,更多的是指向一个漂亮的 HTTP 错误。

我的环境在一个数字海洋水滴中拥有所有最新版本(PHP、NGINX、Ubuntu、FPM 和 FastCGI)。

我的 confs 包含:

php.ini (FPM and CLI)

file_uploads = On
upload_max_filesize = 700M
max_file_uploads = 20
post_max_size = 710M
max_execution_time = 3000
max_input_time = 6000
memory_limit = 700M

nginx.conf and "site".conf (http, server and location contex)

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon image/jpeg image/png image/jpg;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5000;
types_hash_max_size 2048;
client_max_body_size 700M;

我尝试将其添加到 NGINX:

client_body_timeout   300;
client_header_timeout 300;
send_timeout 300;

不工作。

在我所有的搜索之后,错误仍然存​​在,我不会看到退出这个错误。

拜托,有人帮帮我吗?

【问题讨论】:

  • “注意:对于非常大的文件,您可能需要更改 client_body_timeout 参数的值。默认为 60 秒。” (easyengine.io/tutorials/php/increase-file-upload-size-limit)
  • 感谢@04FS 的回复。请看我的编辑。这不起作用(我在发布之前尝试过)。
  • 你检查过错误日志的内容吗?
  • 尝试client_body_timeout 3600; client_header_timeout 3600;发送超时 3600;也别忘了重启php-fpm和nginx
  • 你使用 cloudflare 吗? Cloudflare 或其他服务提供商使用某种上传限制!

标签: php wordpress nginx server


【解决方案1】:

如果它是一个新的 Droplet,有时当您将本地 WordPress 网站上传到它时,您需要更改 www 用户的文件权限。您可能没有权限执行此操作。

那就试试吧

chown -Rf www-data.www-data /var/www/html/

根据您的服务器设置更改路径 /html/

【讨论】:

  • 感谢您的回复!这不能解决我的问题。我拥有所有权限,错误为 413(太大)。
【解决方案2】:

解决了!

如果您在客户端和服务器之间使用 CDN 或类似服务,请查看这是否对最大上传文件有限制。

就我而言,我使用了 cloudflare,它在任何地方都没有显示此限制,也没有显示澄清错误。

不过,谢谢大家的回复。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 2011-05-20
    • 2011-05-04
    • 1970-01-01
    • 2013-08-11
    • 2018-10-15
    • 1970-01-01
    相关资源
    最近更新 更多