如何在具有别名的Apache虚拟主机上配置多个SSL证书?

时间:2017-02-01 12:25:58

标签: apache ssl certificate apache2 virtualhost

我有一个在几个国家/地区域上使用相同代码运行的网络应用。 Apache配置了别名。除了配置单个SSL证书之外,这是有效的:

    ServerAlias *.server-at
    ServerAlias *.server-ch
    ServerAlias *.server-es

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/rex.server-de.crt
    SSLCertificateKeyFile /etc/ssl/private/rex.server-de.key

是否可以使用apache2在虚拟主机容器中配置多个SSL证书?

1 个答案:

答案 0 :(得分:3)

您可以使用虚拟主机轻松配置各个证书,以便按ServerName区分请求。例如

listen 443

<VirtualHost *:443>
    ServerName rex.server.de:443
    SSLEngine on
    SSLCertificateFile " /etc/ssl/certs/rex.server-de.crt"
    SSLCertificateKeyFile " /etc/ssl/certs/rex.server-de.key"
</VirtualHost>

<VirtualHost *:443>
    ServerName rex.server.at:443
    SSLEngine on
    SSLCertificateFile " /etc/ssl/certs/rex.server-at.crt"
    SSLCertificateKeyFile " /etc/ssl/certs/rex.server-at.key"
</VirtualHost>