问题描述
我想在apache(apache 2.2.22和openssl 1.0.1,debian 7.6)上用自己的ssl证书配置两个虚拟主机.我找到了许多有关SNI的文章,但仍然无法正确配置它.这是我的配置:
I want to configure two virtual hosts with their own ssl certificates on apache (apache 2.2.22 and openssl 1.0.1, debian 7.6). I've found many articles about SNI, but still can't configure it properly. Here's my config:
ports.conf
NameVirtualHost *:80
NameVirtualHost *:443
Listen 80
<IfModule mod_ssl.c>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
test1-ssl
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName test1.com
DocumentRoot /var/www/test1
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/test1.crt
SSLCertificateKeyFile /etc/apache2/ssl/test1.key
</VirtualHost>
</IfModule>
test2-ssl
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName test2.test.pl
DocumentRoot /var/www/test2
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/test2.crt
SSLCertificateKeyFile /etc/apache2/ssl/test2.key
</VirtualHost>
</IfModule>
域 https://test1.com 正常运行(使用自己的证书).域 https://test2.test.pl 显示域test1.com的内容,并使用test1 ssl证书而不是test2 .crt(定义在配置文件test2-ssl中).任何想法,建议表示赞赏.
Domain https://test1.com works properly (with its own certificate).Domain https://test2.test.pl displays content of domain test1.com and uses test1 ssl certificate instead of test2.crt (as it is defined in config file test2-ssl).Any ideas,sugestions very appreciated.
亲切的问候,并预先感谢!
Kind regards,and thanks in advance!
推荐答案
经过更多的搜索后,发现有可能().我唯一的问题是两个单独的域配置文件...当我在一个配置文件中为域配置虚拟主机时,它起作用了.
After little more searching it turns out that it's possible (https://www.digicert.com/ssl-support/apache-multiple-ssl-certificates-using-sni.htm). My only problem was two separate configuration files for domains... when I configure virtualhost for domains in one config file it worked.
这篇关于Apache上的多个SSL虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!