AWS:创建新环境(tomcat-single-instance):.ebextensions with SSL 证书 - 无法启动

时间:2020-12-24 15:08:14

标签: amazon-web-services ssl tomcat amazon-linux ebextensions

Elastic Beanstalk:创建新环境:.ebextensions with SSL 证书无法启动(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 Forum 上发布了这个问题。请帮忙。

2 个答案:

答案 0 :(得分:2)

AWS documentation 中所示:

<块引用>

从随 Java with Tomcat platform update on May 24, 2018 发布的 Tomcat 平台 3.0.0 版配置开始,Apache 2.4 是 Tomcat 平台的默认代理。

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

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

在此特定情况下,存在一些与创建日志记录所需文件相关的其他问题。将路径调整为应用程序可以写入的路径,即Beanstalk中Tomcat的默认路径/var/logs/tomcat8,似乎一切正常。

答案 1 :(得分:1)

省去自己的痛苦。请勿在 Tomcat 服务器中配置 SSL,请在 AWS 弹性负载均衡器 ELB 上进行。