I am deploying a Node JS/ Express JS application to AWS Elastic Beanstalk environment. I am creating custom nginx config file to change a setting. To do that I created the following file.
{project_root_directory}/.platform/nginx/conf.d/elasticbeanstalk/mynginx.conf
server {
client_max_body_size 512M;
}
Then to deploy the application as usual, I zip my project and upload the zip in the AWS console. After the environment is updated, I checked the file on the server and it is not there.
Why the file is not there and how can I fix it, please?
The followings are the details.
Image is Amazon Linux 2 AMI.
I created a .ebextensions folder right inside the root folder with the following files
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"
Then again I created .platform/nginx/conf.d/mynginx.config file right inside the root folder with the following content.
server {
client_max_body_size 512M;
}
So I have the project structure like this.
Then I zip the project. Then login to the AWS console and go to the Beanstalk console and upload the zip file there.
CodePudding user response:
Assuming that you are using Amazon Linux 2 EB platform, the correct folder should be:
{project_root_directory}/.platform/nginx/conf.d/mynginx.conf
not
{project_root_directory}/.platform/nginx/conf.d/elasticbeanstalk/mynginx.conf
Update:
Your mynginx.conf
should be:
client_max_body_size 512M;