merlin
merlin

Reputation: 2917

How to configure multiple SSL certs on Apache virtual host with aliases?

I have a web-app that runs on several country domains with the same code. Apache is configured with aliases. This works, except for the point of configuring individual SSL-certs:

    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

Is it possible with apache2 to configure more than one SSL certificate inside a virtualhost container?

Upvotes: 5

Views: 14576

Answers (1)

pedrofb
pedrofb

Reputation: 39271

You can configure the individual certificates easily using a virtual host for each domain differentiating requests by ServerName. For example

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> 

Upvotes: 6

Related Questions