1

好的,我已经被这个问题困扰了将近一个星期。

这就是我的配置文件的样子。

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

注释掉的文件命令也曾经尝试过。

这两个配置文件都位于.ebextensions文件夹中,.ebextensions文件夹是这样的

https://i.stack.imgur.com/AC7VM.png

但是 qqd.war 会如下

myWebApp.zip
  |__ qqd.war
  |__ ROOT.war

whereROOT.war是使用 touch 命令创建的。因此它是空文件。 ROOT.war不包含.ebextensions

qqd.war下的配置文件.ebextensions似乎都没有运行。1)为什么?2) 我应该在 .config 文件的命令中包含 sudo 吗?

我在这里阅读了大多数最佳答案并尝试了这个https://medium.com/trisfera/getting-to-know-and-love-aws-elastic-beanstalk-configuration-files-ebextensions-9a4502a26e3c

没运气。请帮我。

4

1 回答 1

1

在多个 .war 项目中,您的 .ebxtensions 文件夹需要位于根目录,因为它适用于机器(EC2 实例),而不是单个 web 应用程序。

MyApplication.zip
├── .ebextensions
├── foo.war
├── bar.war
└── ROOT.war

此处对此进行了解释以供进一步阅读:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-multiple-war-files.html

于 2017-11-09T19:24:45.643 回答