我知道这可能被认为是重复的:在AWS Elastic Beanstalk中自定义Nginx配置(以及其他问题),但是我无法使我的代码与任何提出的解决方案一起工作。
这是我的config.yml文件的外观(xxx = 环境名称):
branch-defaults:
master:
environment: xxx
environment-defaults:
xxx:
branch: master
repository: xxx
global:
application_name: xxx
default_ec2_keyname: null
default_platform: arn:aws:elasticbeanstalk:eu-west-1::platform/Node.js running on
64bit Amazon Linux/4.3.0
default_region: eu-west-1
instance_profile: null
platform_name: null
platform_version: null
profile: null
sc: git
workspace_type: Application
然后添加:
http:
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
http {
client_max_body_size 20M;
}
container_commands:
01_reload_nginx:
command: "service nginx reload"
为了允许更大的有效载荷并尝试在部署后重新启动nginx以接受更改。但是,即使它似乎是被接受的方法,在我的代码中却无法正常工作。除小于1mb的较小文件外,其他所有内容都完美地运行。
谢谢你的帮助!
.ebextensions
并验证 nginx 配置文件的名称。它必须以.config
结尾。.ebextensions
内容是否复制到应用程序包中。/etc/nginx/conf.d/proxy.conf
。.ebextensions
应该放在应用程序包的根目录下。