AWS EC2 实例 - 服务器证书不包含与服务器名称匹配的 ID

问题描述 投票:0回答:1

我正在尝试在 AWS EC2 实例上设置 Nextcloud,除了一件事之外,一切似乎都工作正常。

我已将服务器从原始名称重命名为正确的域:

ubuntu@nextcloud:/var/log/apache2# cat /etc/hostname
nextcloud.xxx-aws.com

nextcloud-le-ssl.conf 中的配置确实反映了正确的域名

ubuntu@nextcloud:/var/log/apache2# cat /etc/apache2/sites-enabled/nextcloud-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
  DocumentRoot /var/www/nextcloud/
  ServerName  nextcloud.xxx-aws.com
  ServerAlias nextcloud.xxx-aws.link

  <Directory /var/www/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

    <IfModule mod_dav.c>
      Dav off
    </IfModule>

    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>

  </Directory>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/nextcloud.xxx-aws.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.xxx-aws.com/privkey.pem
</VirtualHost>
</IfModule>

但是当我启动 apache 时,我在错误日志中看到了这条消息,并且认为这可能会使应用程序时不时地崩溃。

ubuntu@nextcloud:/var/log/apache2# tail -f error.log
[Wed Jan 24 06:40:42.392510 2024] [ssl:warn] [pid 459] AH01909: ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com:443:0 server certificate does NOT include an ID which matches the server name

证书是使用 Certbot 生成的。

我不确定我在这里做错了什么。

我不完全确定如何解决这个问题。

apache amazon-ec2 ssl-certificate certbot
1个回答
0
投票

将主机名添加到 /etc/hosts 中的 localhost 并更新证书似乎已经解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.