如何在 ubuntu apache2 ec2 实例上正确启用 SSL?

use*_*461 5 ssl ssl-certificate apache-2.4

我已经为 SSL 设置了一个 ubuntu (14.04.2) apache2 (2.4.7) 服务器,但似乎没有找到证书。Ubuntu 运行在具有静态 IP 的 EC2 实例上,启用了 443 端口和域名 theaudioserver.com 以及该静态 IP 的 DNS 记录。这是我设置服务器的方法:

  • 创建的密钥: openssl genrsa 2048 > privatekey.pem
  • 生成的证书请求: openssl req -new -key privatekey.pem -out csr.pem
  • 使用 csr 购买了 CA SSL 证书并将密钥保存到server.crtserver_bundle.crt
  • ssl.conf在 /etc/apache2/sites-available 中添加文件,该文件为 SSL 配置:
    SSLStaplingCache shmcb:/tmp/stapling_cache(128000) <VirtualHost *:443>
    SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH SSLProtocol All -SSLv2 -SSLv3 SSLHonorCipherOrder On Header always set
    Strict-Transport-Security "max-age=63072000; includeSubdomains;
    preload" Header always set X-Frame-Options DENY Header always set
    X-Content-Type-Options nosniff
    SSLCompression off SSLUseStapling on
    ServerName theaudioserver.com
    SSLEngine on
    SSLCertificateFile /home/ubuntu/certs/server.crt
    SSLCertificateKeyFile /home/ubuntu/certs/privatekey.pem
    SSLCertificateChainFile /home/ubuntu/certs/server_bundle.crt

    DocumentRoot /var/www/html/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
  • 添加了 SSL sudo a2enmod ssl
  • 成功重启apache2(日志中没有任何错误)
  • 我还检查了 apache2 是否正在侦听 443 并且它似乎在侦听正确性:sudo netstat -anp | grep apache给出:tcp6 0 0 :::443 :::* LISTEN 3138/apache2

但是当我测试我的域时,似乎没有找到证书。

在 ssllabs.com 上,我得到No SSL certificates were found on theaudioserver.com. Make sure that the name resolves to the correct server and that the SSL port (default is 443) is open on your server's firewall.

通过https://52.24.39.220访问服务器时,我收到一个名称不匹配错误,因为我没有通过域名访问,但这表明 EC2 上的服务器防火墙似乎设置正确。

我在这里做错了什么?

use*_*517 2

我在端口 443 上根本无法连接到您的服务器,感觉像是防火墙问题。您是否在 EC2 安全组防火墙中打开了端口 443。您是否在主机的防火墙中打开了它?


更新;

您的 DNS 设置不正确

dig +short theaudioserver.com
52.25.39.220
Run Code Online (Sandbox Code Playgroud)

而你说你可以通过 52.24.39.220连接