简体   繁体   English

client_max_body_size 在 Nginx conf 中,但似乎被忽略了

[英]client_max_body_size is in Nginx conf but seems to be getting ignored

I'm running into status code 413 Request Entity Too Large .我遇到了状态码413 Request Entity Too Large I'm running an Amazon Linux 2 AMI instance on AWS's Elastic Beanstalk, which is running an express server with a post route that uploads files to an S3 Bucket and then both adds some data to a table and produces a kafka message.我在 AWS 的 Elastic Beanstalk 上运行一个 Amazon Linux 2 AMI 实例,该实例运行一个快速服务器,该服务器具有一个将文件上传到 S3 存储桶的发布路由,然后都将一些数据添加到表中并生成一条 kafka 消息。 Everything is working properly with files below 1MB size.对于小于 1MB 的文件,一切正常。

I understand nginx's default max-size value is 1MB and that I must change it.我了解 nginx 的默认最大大小值为 1MB,我必须更改它。

I tried every answer in this thread Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk but despite getting the client_max_body_size 10M;我尝试了这个线程中的每个答案, 增加了 AWS Elastic Beanstalk 上 Nginx conf 中的 client_max_body_size,但尽管得到了client_max_body_size 10M; inside the nginx.conf file, and restarting nginx everytime I changed a configuration, using nginx -t to see if anything was wrong with the syntax, resulting in everything being ok , and finally proving via this command that the client_max_body_size 10M; inside the nginx.conf file, and restarting nginx everytime I changed a configuration, using nginx -t to see if anything was wrong with the syntax, resulting in everything being ok , and finally proving via this command that the client_max_body_size 10M; line was in fact there, when it accused of there being a duplicate of it inside the file, all of these configs seemed to be completely ignored by my micro-service whenever I try to post a file greater than 1MB.该行实际上就在那里,当它指责文件中有它的副本时,每当我尝试发布大于 1MB 的文件时,我的微服务似乎完全忽略了所有这些配置。

I don't have much ideas on where to proceed from here.我对从这里开始的地方没有太多想法。 Any tips?有小费吗?

The link you are giving is for Amazon Linux 1 (AL1).您提供的链接适用于 Amazon Linux 1 (AL1)。 These days all EB platform are based on AL2, and nginx is set differently .现在所有的EB平台都是基于AL2的,nginx的设置不同 Namely, you should create .platform/nginx/conf.d/myconfig.conf file in the root of your application, with the content of:即,您应该在应用程序的根目录中创建.platform/nginx/conf.d/myconfig.conf文件,其内容为:

client_max_body_size 10M;

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

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