0

Elastic Beanstalk:创建新环境:带有 SSL 证书的 .ebextensions 无法启动(tomcat-single-instance)

我正在尝试使用当前的生产 WAR 包创建一个新环境。

新实例部署失败并出现“绿色”状态。我们最初按照此示例创建 .ebextensions ( https://s3.amazonaws.com/elasticbeanstalk-single-instance-ssl-demo/tomcat-single-instance.zip ) 并按照此处https://docs的描述进行扩展。 aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-tomcat.html

New Platform: Managed, Tomcat 8.5 with Java 8 on 64bit Amazon Linux
Platform version: 3.4.1(Recommended)

错误:

httpd24-tools conflicts with httpd-tools-2.2.34-1.16.amzn1.x86_64
mod24_ssl conflicts with 1:mod_ssl-2.2.34-1.16.amzn1.x86_64
httpd24 conflicts with httpd-2.2.34-1.16.amzn1.x86_64

为了解决这个错误,我更换了

packages:
  yum:
    mod_ssl : []

packages:
  yum:
    mod24_ssl.x86_64 : []

但这导致了这个错误:

Httpd configuration detected in the '.ebextensions/httpd' directory. AWS Elastic Beanstalk will no longer manage the httpd configuration for this environment.
Executing: /usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf
httpd: Syntax error on line 21 of /var/elasticbeanstalk/staging/httpd/conf/httpd.conf: Include/IncludeOptional: No matches for the wildcard '*.conf' in '/etc/httpd/conf.d/elasticbeanstalk', failing
Failed to execute '/usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf'
Failed to execute '/usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf' (Executor::NonZeroExitStatus)

AWS 要求立即更换当前的生产服务器 (Amazon Linux/2.3.1),因为它已“退休”。我也在AWS 论坛上发布了这个问题。请帮忙。

4

2 回答 2

2

拯救自己的痛苦。不要在您的 Tomcat 服务器中配置 SSL,而是在 AWS Elastic Load Balancer ELB 上进行。

于 2020-12-29T00:14:23.357 回答
2

AWS 文档中所示:

从2018 年 5 月 24 日随 Java with Tomcat 平台更新发布的 Tomcat 平台版本 3.0.0 配置开始,Apache 2.4 是 Tomcat 平台的默认代理。

在深入研究问题后,从评论和同伴聊天中可以看出,问题的实际解决方案是创建或克隆现有环境,其想法是能够为 Amazon Linux 3.4 使用新的 beanstalk 环境。 2、无需任何定制。

然后,为了避免提到的 SSL 问题,该.ebextensions目录应该只包含问题中指示的示例 zip 文件中提供的方便ssl.conf的脚本,而没有该部分,因为已经安装在 beanstalk 映像中。environment.configpackagesmod_ssl

在这种特定情况下,与创建日志记录所需的文件有关的一些额外问题。在将路径调整为应用程序可以编写的路径后,Beanstalk 中 Tomcat 的默认路径/var/logs/tomcat8,一切似乎都正常工作。

于 2020-12-31T13:51:48.687 回答