Wai*_*ein 3 nginx amazon-web-services node.js express amazon-elastic-beanstalk
我正在将 Node JS/ Express JS 应用程序部署到 AWS Elastic Beanstalk 环境。我正在创建自定义 nginx 配置文件来更改设置。为此,我创建了以下文件。
{project_root_directory}/.platform/nginx/conf.d/elasticbeanstalk/mynginx.conf
server {
client_max_body_size 512M;
}
Run Code Online (Sandbox Code Playgroud)
然后,为了像往常一样部署应用程序,我压缩我的项目并在 AWS 控制台中上传该 zip 文件。环境更新后,查看服务器上的文件,没有。
为什么该文件不存在以及如何修复它?
详情如下:
图像是 Amazon Linux 2 AMI。
我在根文件夹内创建了一个 .ebextensions 文件夹,其中包含以下文件:
00-文件.config
files:
"/etc/nginx/conf.d/mynginx.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 512M;
Run Code Online (Sandbox Code Playgroud)
01-nodecommand.config
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeCommand
value: "npm start"
Run Code Online (Sandbox Code Playgroud)
02-迁移命令.config
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: MigrationCommand
value: "npx sequelize-cli db:migrate"
Run Code Online (Sandbox Code Playgroud)
然后,我再次在根文件夹内创建了 .platform/nginx/conf.d/mynginx.config 文件,其中包含以下内容。
server {
client_max_body_size 512M;
}
Run Code Online (Sandbox Code Playgroud)
所以我有这样的项目结构。
然后我压缩该项目。然后登录 AWS 控制台并转到 Beanstalk 控制台并在那里上传 zip 文件。
假设您使用的是 Amazon Linux 2 EB 平台,正确的文件夹应该是:
{project_root_directory}/.platform/nginx/conf.d/mynginx.conf
Run Code Online (Sandbox Code Playgroud)
不是
{project_root_directory}/.platform/nginx/conf.d/elasticbeanstalk/mynginx.conf
Run Code Online (Sandbox Code Playgroud)
更新:
你的mynginx.conf应该是:
client_max_body_size 512M;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1675 次 |
| 最近记录: |