Share one ssl certificate between multiples vhost

Posted by Cesar on Server Fault See other posts from Server Fault or by Cesar
Published on 2014-06-04T01:14:30Z Indexed on 2014/06/04 3:26 UTC
Read the original article Hit count: 208

Filed under:
|

I have a setup like this:

<VirtualHost 192.168.1.104:80>
    ServerName domain1
    DocumentRoot /home/domain/public_html
    ...
</VirtualHost>
<VirtualHost 192.168.1.104:80>
    ServerName domain2
    DocumentRoot /home/domain2/public_html
    ...
</VirtualHost>
<VirtualHost 192.168.1.104:80>
    DocumentRoot /home/domain3/public_html
    ServerName domain3
    ...
</VirtualHost>

<VirtualHost 192.168.1.104:443>
    ServerName domain3
    SSLCertificateFile /usr/share/ssl/certs/certificate.crt
    SSLCertificateKeyFile /usr/share/ssl/private/private.key
    SSLCACertificateFile /usr/share/ssl/certs/bundle.cabundle
    ...
</VirtualHost>

I want to use domain3 certificate in the other domains, preferably without having to repeat all the <VirtualHost 192.168.1.104:443> config.

In other words I want something like this: If the vhost has no explicit ssl config use cert for domain3 (/usr/share/ssl/certs/certificate.crt)

Notes:

1.- I for sure will be setting more vhosts in the future

2.- I know (and don't care) of the ssl warnings the browser will show (hostname mismatch)

If this possible? how?

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about ssl