使用 .platform 目录中的 .config 文件手动创建配置文件。
具体操作步骤如下:
- 在项目根目录下创建 .platform 目录;
- 在 .platform 目录中创建 nginx 目录;
- 在 nginx 目录中创建一个名为 nginx.conf 的文件;
- 在 nginx.conf 中编写 nginx 配置;
- 在 .platform 目录中创建一个名为 .config 的文件;
- 在 .config 中添加以下内容:
hooks:
build: |
echo "Copying nginx config..."
cp .platform/nginx/nginx.conf /etc/nginx/conf.d/
- 将以上内容添加到 .config 文件中,并保存;
- 执行 git add .platform 和 git commit -m "Add nginx config" 命令,将更改推送到远程仓库;
- 在 AWS Beanstalk 上部署项目。
以上操作完成后,AWS Beanstalk 将会自动将您的 nginx 配置文件添加到部署环境中。