nginx 413请求实体太大(客户端打算发送太大的主体)


nginx 413 Request Entity Too Large(client intended to send too large body)

我知道这个问题已经被问过多次了,但我已经尝试了所有这些问题,并将client_max_body_size更新为0,甚至16400M,但它没有帮助。我确实要求我的主机支持重新启动nginx和php fpm服务。

我的服务器配置是:

2 gb内存,Plesk服务器版本:Plesk 12.5.30Wordpress版本:4.6.1PHP版本:7.0.12设置在fastCGI application served by apache运行PHP

这个网站是在wordpress中,我甚至不能从wordpress媒体上传器或通过任何其他形式上传大于100mb的文件。

媒体上传器在ajax post请求中给出了这个错误:POST https://transcriptionpanda.com/wp-admin/async-upload.php

在我的服务器日志中,我看到这个nginx错误:15271#0: *307 client intended to send too large body: 710634025 bytes

我的/etc/nginx/nginx.conf代码是:

#user  nginx;
worker_processes  1;
#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;
#pid        /var/run/nginx.pid;
include /etc/nginx/modules.conf.d/*.conf;
events {
    worker_connections  1024;
}

http {
client_max_body_size 0;
client_header_buffer_size 4k;
large_client_header_buffers  4 4k;
client_body_buffer_size  256k;
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #tcp_nodelay        on;
    #gzip  on;
    #gzip_disable "MSIE [1-6]'.(?!.*SV1)";
    server_tokens off;
    include /etc/nginx/conf.d/*.conf;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
我现在真的绝望了,不知道该怎么办。较小的文件上传很好(100MB左右)。大于100MB的文件上传失败。

如有任何帮助,不胜感激。

:下面是网站服务器的phpinfo链接:https://transcriptionpanda.com/phpinfo.php

请检查以下配置-

Nginx

client_max_body_size
PHP

post_max_size
upload_max_filesize

和重启。源:

  • http://nginx.org/en/docs/http/ngx_http_core_module.html client_max_body_size
  • http://php.net/manual/en/ini.core.php