我正在將一個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
span class="hljs-attr">option_settings:
- namespace: aws:elasticbeanstalk: container: nodejs
option_name: NodeCommand。
value: "npm start"/span>
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檔案。
uj5u.com熱心網友回復:
假設你使用的是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;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/327653.html
標籤:



