Apache上的多个SSL虚拟主机 [英] multiple ssl virtual hosts on apache

查看:159
本文介绍了Apache上的多个SSL虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在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虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆