我目前已将 Apache 设置为在我的所有域上使用证书,并使用 ssl.conf 中的以下设置:
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /etc/httpd/conf/mycert.crt
SSLCertificateKeyFile /etc/httpd/conf/mykey.key
SSLCertificateChainFile /etc/httpd/conf/digicert/DigiCertCA.crt
</VirtualHost>
我想为服务器上的一个域/虚拟主机使用不同的自签名证书。我尝试将其添加到我的 httpd.conf 文件中,但旧证书仍显示在浏览器中。
<VirtualHost *:443>
ServerName myotherdomain.com
DocumentRoot /var/www/symfony/web
SSLEngine on
SSLCertificateFile /etc/httpd/conf/selfsigned.crt
SSLCertificateKeyFile /etc/httpd/conf/selfsigned.key
SSLCertificateChainFile /etc/httpd/conf/digicert/DigiCertCA.crt
</VirtualHost>
有没有办法进行设置,以便这个域使用与其他域不同的证书?
答案1
您应该NameVirtualHost *:443
在之前使用VirtualHost
:
NameVirtualHost *:443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /etc/httpd/conf/mycert.crt
SSLCertificateKeyFile /etc/httpd/conf/mykey.key
SSLCertificateChainFile /etc/httpd/conf/digicert/DigiCertCA.crt
</VirtualHost>
<VirtualHost *:443>
ServerName myotherdomain.com
DocumentRoot /var/www/symfony/web
SSLEngine on
SSLCertificateFile /etc/httpd/conf/selfsigned.crt
SSLCertificateKeyFile /etc/httpd/conf/selfsigned.key
SSLCertificateChainFile /etc/httpd/conf/digicert/DigiCertCA.crt
</VirtualHost>