在AWS弹性魔豆增加client_max_body_size在Nginx的的c​​onf [英] Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk

查看:241
本文介绍了在AWS弹性魔豆增加client_max_body_size在Nginx的的c​​onf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我张贴的文件大于10MB时,我们的API在AWS弹性魔豆运行运行到413请求实体太大的错误。

I'm running into "413 Request Entity Too Large" errors when posting files larger than 10MB to our API running on AWS Elastic Beanstalk.

我已经做了相当多的研究,认为我需要了 client_max_body_size 作为Nginx的,但是我似乎无法找到如何做到这一点使用弹性青苗的任何文件。我的猜测是,它需要使用ebetension文件进行修改。

I've done quite a bit of research and believe that I need to up the client_max_body_size for Nginx, however I cannot seem to find any documentation on how to do this using Elastic Beanstalk. My guess is that it needs to be modified using an ebetension file.

任何人有我如何能达极限的想法? 10MB是pretty的薄弱,必须有办法了这个手动。

Anyone have thoughts on how I can up the limit? 10MB is pretty weak, there has to be a way to up this manually.

推荐答案

大量的研究,并与美妙的AWS支持团队工作小时后,我创建了 .ebextensions 修改nginx的配置。这种变化使放大后的车身尺寸。

After much research and hours of working with the wonderful AWS support team, I created a config file inside of .ebextensions to modify the nginx config. This change allowed for a larger post body size.

.ebextensions 目录中,我创建了一个名为 01_files.config 包含以下内容的文件:

Inside of the .ebextensions directory, I created a file called 01_files.config with the following contents:

files:
    "/etc/nginx/conf.d/proxy.conf" :
        mode: "000755"
        owner: root
        group: root
        content: |
           client_max_body_size 20M;

这产生/etc/nginx/conf.d目录内的proxy.conf文件。该proxy.conf文件只包含一个班轮 client_max_body_size 20M; 其中的伎俩

This generates a proxy.conf file inside of the /etc/nginx/conf.d directory. The proxy.conf file simply contains the one liner client_max_body_size 20M; which does the trick.

您可以指定在Nginx的文档中描述的其他指令。

You can specify other directives which are outlined in Nginx documentation.

http://wiki.nginx.org/Configuration

希望这有助于其他人!

这篇关于在AWS弹性魔豆增加client_max_body_size在Nginx的的c​​onf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆