是否可以在没有公共IP和DNS的情况下在Web服务器上测试SSL配置?

时间:2020-10-09 19:58:16

标签: ssl testing apache2

我在ubuntu 20.04 / apache2上测试配置 因为它是用于测试,所以我在本地通过/ etc / hosts绕过DNS: xxx.xx.xxx.xxx mydomain.com xxx.xx.xxx.xxx project1.mydomain.com 对于所有项目,等等

对于所有http(端口80)虚拟主机都可以正常工作

现在我将为所有这些虚拟主机测试https

但是有可能吗?

我做什么:

。 sudo openssl req -new -newkey rsa:2048 -nodes -keyout mydomain.key -out mydomain.csr ->它给了我两个文件。好 ->我发送了mydomain.csr以获得证书,并且收到了mydomain.cer

。我对project1虚拟主机的配置

<VirtualHost *:80>
    ServerName project1.mydomain.com
    ServerAlias www.project1.mydomain.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/project1
    DirectoryIndex index.php

    <Directory /var/www/project1>
        Options -Indexes +FollowSymlinks
        AllowOverride All
        Require all granted 
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:443>
        ServerName project1.mydomain.com
        ServerAlias www.project1.mydomain.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/project1
        DirectoryIndex index.php

        <Directory /var/www/project1>
                Options -Indexes +FollowSymlinks
                AllowOverride All
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/certs/mydomain.cer
    SSLCertificateKeyFile /etc/apache2/ssl/private/mydomain.key
</VirtualHost>

http://project1.mydomain.com还可以

https://project1.mydomain.com是KO->无法访问

我不知道是否与此错误日志有关:

[ssl:warn] AH01909:project1.mydomain.com:443:0服务器证书不包含与服务器名称匹配的ID

任何帮助将不胜感激!谢谢!!

0 个答案:

没有答案