簡體   English   中英

上傳/部署 zip 文件時,不會創建 .platform 掛鈎中的 AWS Elastic Beanstalk 自定義 nginx .conf 文件

[英]AWS Elastic Beanstalk custom nginx .conf file in the .platform hooks is not created when zip file is uploaded/ deployed

我正在將 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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM