【问题标题】:Nginx client_max_body_size not workingNginx client_max_body_size 不起作用
【发布时间】:2017-01-02 15:23:46
【问题描述】:

这应该是一个快速修复。 因此,由于某种原因,如果不返回 413 Request Entity Too Large,我仍然无法成功获得大于 1MB 的请求。

例如,使用以下配置文件和大小约为 2MB 的请求,我在 nginx error.log 中收到以下错误消息:

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

我尝试设置下面设置的配置,然后重新启动我的 nginx 服务器,但我仍然收到 413 错误。 是不是我做错了什么?

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;
    }
  }

提前感谢您的帮助!

【问题讨论】:

标签: nginx


【解决方案1】:

我很惊讶你没有收到回复,但我的直觉是你已经在另一个配置文件的其他地方设置了它。

看看nginx - client_max_body_size has no effect

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2020-03-04
      • 2015-01-30
      • 2018-02-20
      • 2015-04-13
      • 2012-02-21
      • 2011-06-24
      • 2011-01-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多