为 Apache 调试自签名 SSL 证书时遇到问题

Roh*_*hit 2 ssl apache-2.2 apache-2.4

我正在尝试设置一个自签名 SSL 证书,以便我可以使用 SSL 开发我的应用程序(这样我最终可以让我的网站使用 SSL 运行......)。我创建了一个带有无头 API (Lumen) 的 Angular 站点,并尝试使用 ServerFault 中的一个问题来设置多域 SSL 证书:

如何为Apache2创建多域自签名证书?

测试命令已检出,因此我尝试使用以下 Apache 配置安装证书:

<VirtualHost *:80>
        ServerAdmin contact@gamersplane.com
        ServerName api.gamersplane.local
        DocumentRoot /var/www/GamersPlane.api/public
        <Directory /var/www/GamersPlane.api/public/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        ErrorLog "|/usr/bin/cronolog /var/log/gamersplane/%Y/%m/%d/error.log"

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel notice

        CustomLog ${APACHE_LOG_DIR}/gamersplane/access.log combined

        SSLEngine on
        SSLCertificateFile /var/www/GamersPlane.api/ssl/gamersplane.local.pem
        SSLCertificateKeyFile /var/www/GamersPlane.api/ssl/gamersplane.local.key
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我点击我的网站时,我得到This site can’t provide a secure connection. 我尝试为此使用谷歌搜索,但一切似乎都特定于某些站点/配置,我无法弄清楚如何调试出了什么问题。

我通过 Digital Ocean 指南设置了 Apache 配置,该指南还推荐了这些我不确定的配置。我试过有没有他们,没有运气:

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
</Directory>
Run Code Online (Sandbox Code Playgroud)

我很乐意帮助您了解如何调试/解决此类问题。

Mir*_*ici 5

您需要在端口 443 上配置另一个 apache VirtualHost 和侦听。

参见:https : //httpd.apache.org/docs/2.4/ssl/ssl_howto.html

当您可以从https://letsencrypt.org/免费获得公共证书颁发机构签名的证书时,即使用于开发,我也不会使用自签名证书