Ok, I have been struck on this problem for almost a week.
THis is how my config files look.
01touch.config
container_commands:
01_mov_file:
command: "touch /home/createdByContainerCommands.txt"
cwd: /home/
08movehttpdconf.config
Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Auth:
type: "s3"
buckets: ["elasticbeanstalk-us-west-1-11111111111"]
roleName:
"Fn::GetOptionSetting":
Namespace: "aws:autoscaling:launchconfiguration"
OptionName: "IamInstanceProfile"
DefaultValue: "aws-elasticbeanstalk-ec2-role"
commands:
01_gethttpdconf:
command: aws s3 cp s3://elasticbeanstalk-us-west-1-11111111111/resources/environments/httpd.conf /home/
container_commands:
01_mov_file:
command: "cp -f /home/httpd.conf /etc/httpd/conf/httpd.conf"
#files:
# "/etc/httpd/conf/httpd.conf":
# mode: "000755"
# owner: root
# group: root
# authentication: "S3Auth"
# source: https://s3-us-west-1.amazonaws.com/elasticbeanstalk-us-west-1-111111111111/httpd.conf
#
# content: |
# # Managed by Elastic Beanstalk
# PidFile run/httpd.pid
#
# # Enable TCP keepclive
# Timeout 60
# KeepAlive On
# MaxKeepAliveRequests 100
# KeepAliveTimeout 60
#
# <IfModule worker.c>
# StartServers 10
# MinSpareThreads 250
# MaxSpareThreads 250
# ServerLimit 10
# MaxClients 250
# MaxRequestsPerChild 1000000
# </IfModule>
#
# <IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteCond ℅{HTTP_HOST} !^www\. [NC,OR]
# RewriteCond ℅{REQEST_URI} !^/abc
# RewriteRule ^ http://www.example.com/qqd℅{REQUEST_URI} [L,R]
# </IfModule>
#
# Listen 80
#
# Include conf.d/*.conf
# Include conf.d/elasticbeanstalk/*.conf
#
# User apache
# Group apache
#
# CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
# TraceEnable off
#
# LoadModule alias_module modules/mod_alias.so
# LoadModule authz_host_module modules/mod_authz_host.so
# LoadModule log_config_module modules/mod_log_config.so
# LoadModule deflate_module modules/mod_deflate.so
# LoadModule headers_module modules/mod_headers.so
# LoadModule proxy_module modules/mod_proxy.so
# LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
# LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
# LoadModule proxy_http_module modules/mod_proxy_http.so
# LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
# LoadModule proxy_connect_module modules/mod_proxy_connect.so
# LoadModule cache_module modules/mod_cache.so
# LoadModule setenvif_module modules/mod_setenvif.so
# LoadModule rewrite_module modules/mod_rewrite.so
The commented out files command was also once tried out.
Both these config files are located in .ebextensions
folder and .ebextensions
folder is like this
https://i.sstatic.net/AC7VM.png
But the qqd.war would be as follows
myWebApp.zip
|__ qqd.war
|__ ROOT.war
where ROOT.war
is created using touch command. Hence it is empty file.
ROOT.war
doesn't contain .ebextensions
None of the config files under .ebextensions
of qqd.war seems to be running.
1) Why?
2) Should I include sudo in my commands in .config files?
I read most of the top answers here and tried this as well https://medium.com/trisfera/getting-to-know-and-love-aws-elastic-beanstalk-configuration-files-ebextensions-9a4502a26e3c
No luck. Please help me.
In a multiple .war project, your .ebxtensions folder needs to be at the root as it applies to the machine (EC2 instance), not an individual webapp.
MyApplication.zip
├── .ebextensions
├── foo.war
├── bar.war
└── ROOT.war
This is explained here for further reading:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-multiple-war-files.html