【发布时间】:2021-11-13 05:10:17
【问题描述】:
我正在将 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 文件。
【问题讨论】:
标签: node.js amazon-web-services express nginx amazon-elastic-beanstalk