I need to customize keepalive_timeout settings in /etc/nginx/nginx.conf file which defaults to 65 currently on elastic beanstalk ec2 instance.
I followed the following description but when I deploy new code I get nginx error like:
[emerg] 4551#0: "keepalive_timeout" directive is duplicate in /etc/nginx/conf.d/proxy.conf:2
Later I tried to directly update nginx.conf using sed as follow
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 200M;
client_header_timeout 300;
client_body_timeout 300;
send_timeout 300;
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
container_commands:
01_update_nginx:
command: "sudo sed -i 's/keepalive_timeout 65;/keepalive_timeout 360;/g' /etc/nginx/nginx.conf"
02_restart_nginx:
command: "sudo service nginx reload"
Which is not working again (value is not replaced). So I am looking for proper way to update/customize nginx.conf file. I tried something like this
which gives me an error like:
Service:AmazonCloudFormation, Message:[/Resources/AWSEBAutoScalingGroup/Metadata/AWS::CloudFormation::Init/prebuild_0_appname/files//opt/elasticbeanstalk/#etc#nginx#custom-nginx.conf] 'null' values are not allowed in templates