简体   繁体   English

Nginx client_max_body_size 不起作用

[英]Nginx client_max_body_size not working

This should be a quick fix.这应该是一个快速解决方案。 So for some reason I still can't get a request that is greater than 1MB to succeed without returning 413 Request Entity Too Large.因此,出于某种原因,我仍然无法在不返回 413 Request Entity Too Large 的情况下成功获得大于 1MB 的请求。

For example with the following configuration file and a request of size ~2MB, I get the following error message in my nginx error.log:例如,使用以下配置文件和大小为 ~2MB 的请求,我在 nginx error.log 中收到以下错误消息:

*1 client intended to send too large body: 2666685 bytes,

I have tried setting the configuration that is set below and then restarting my nginx server but I still get the 413 error.我尝试设置下面设置的配置,然后重新启动我的 nginx 服务器,但我仍然收到 413 错误。 Is there anything I am doing wrong?有什么我做错了吗?

server {
    listen      8080;
    server_name *****/api; (*omitted*)

    client_body_in_file_only clean;
    client_body_buffer_size 32K;
    charset     utf-8;
    client_max_body_size 500M;
    sendfile on;
    send_timeout 300s;
    listen 443 ssl;
    location / {
        try_files $uri @(*omitted*);
    }
    location @parachute_server {
        include uwsgi_params;
        uwsgi_pass    unix:/var/www/(*omitted*)/(*omitted*).sock;
    }
  }

Thank you in advance for the help!预先感谢您的帮助!

I'm surprised you haven't received a response but my hunch is you already have it set somewhere else in another config file.我很惊讶你没有收到回复,但我的预感是你已经在另一个配置文件的其他地方设置了它。

Take a look at nginx - client_max_body_size has no effect看看nginx - client_max_body_size 没有影响

奇怪的是,它在 http,location,server 所有块中添加相同的东西“client_max_body_size 100M”后工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM