node.js - 上传/部署 zip 文件时,不会创建 .platform 挂钩中的 AWS Elastic Beanstalk 自定义 nginx .conf 文件
问题描述
我正在将 Node JS/Express JS 应用程序部署到 AWS Elastic Beanstalk 环境。我正在创建自定义 nginx 配置文件来更改设置。为此,我创建了以下文件。
{project_root_directory}/.platform/nginx/conf.d/elasticbeanstalk/mynginx.conf
server {
client_max_body_size 512M;
}
然后像往常一样部署应用程序,我压缩我的项目并将压缩文件上传到 AWS 控制台。更新环境后,我检查了服务器上的文件,它没有。
为什么该文件不存在,我该如何修复它?
以下是详细信息:
图像是 Amazon Linux 2 AMI。
我在根文件夹中创建了一个 .ebextensions 文件夹,其中包含以下文件:
00-files.config
files:
"/etc/nginx/conf.d/mynginx.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 512M;
01-nodecommand.config
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeCommand
value: "npm start"
02-migrationcommand.config
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: MigrationCommand
value: "npx sequelize-cli db:migrate"
然后我再次在根文件夹中创建了 .platform/nginx/conf.d/mynginx.config 文件,其中包含以下内容。
server {
client_max_body_size 512M;
}
所以我有这样的项目结构。
然后我压缩项目。然后登录 AWS 控制台并转到 Beanstalk 控制台并在那里上传 zip 文件。
解决方案
假设您使用的是 Amazon Linux 2 EB 平台,正确的文件夹应该是:
{project_root_directory}/.platform/nginx/conf.d/mynginx.conf
不是
{project_root_directory}/.platform/nginx/conf.d/elasticbeanstalk/mynginx.conf
更新:
你mynginx.conf
应该是:
client_max_body_size 512M;
推荐阅读
- c# - 带有 SimpleInjector 的 WebApi 控制器方法未将记录添加到数据库
- python - 使用 and 和 or 使用 sqlalchemy 进行查询
- java - 无法在 Intellij 中导入 Maven 项目
- r - 使用 do() 函数后按给定 ID 而不是数字输出
- oracle-apex - Oracle APEX 5.1.1 隐藏工具栏操作按钮
- r - 如何根据不同data.frame中的因子将带有因子的列添加到data.frame
- three.js - 用于附加/分离组件的框架状态组件
- windows-installer - Windows 安装程序版本 4.5.6002 24433
- python - 如何找到拟合到 5 阶的(卡方)曲线的参数误差?
- swagger-2.0 - Swagger UI 不在其 url 中显示模块名称,并且