Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can I use a single certificate for two domains which are hosted on the same VPS that is using one IP address?

share|improve this question
add comment

3 Answers

Use the NameVirtualHost directive :

NameVirtualHost *:443

define your vhosts:

<VirtualHost *:443>
  ServerName www.studyhat.blogspot.com
  DocumentRoot "/opt/apache22/htdocs/siteA"
  SSLCertificateFile "/path/to/my/cert"
  SSLCertificateKeyFile "/path/to/my/key"
</VirtualHost>
<VirtualHost *:443>
  ServerName www.studyhat.wordpress.com
  DocumentRoot "/opt/apache22/htdocs/siteB"
  SSLCertificateFile "/path/to/my/cert"
  SSLCertificateKeyFile "/path/to/my/key"
</VirtualHost>
share|improve this answer
    
thanks will try it out... –  firephil Mar 21 '12 at 11:44
add comment

Yes it is possible. This is called a Unified Communication Certificate. Refer to this wikipedia article.

share|improve this answer
    
I was about to answer no, citing the TLS handshake occuring prior to the http request being made, those UC certs are new on me, thanks for the info. –  Oneiroi Mar 19 '12 at 16:44
    
@Oneiroi Even without subject alternate names or a wildcard cert, there's a widely deployed TLS extension to indicate hostname. –  Shane Madden Mar 20 '12 at 1:20
add comment

As detailed in this answer, you essentially get 3 options:

  • Using a wildcard certificate: a certificate issued for *.example.com that would match www1.example.com and www2.example.com. Beware *.example.com will not match example.com. In addition, their usage is generally discouraged (see RFC 6215).
  • Using a certificate with multiple Subject Alternative Name entries. There should be one entry per host. This is generally widely supported. How they're called commercially will depend on the CA (they're sometimes called UCC).
  • Using multiple certificates via the Server Name Indication extension (allowing you to have multiple VirtualHost *:443 with distinct ServerNames and SSLCertificate configuration). This is not supported for any version of IE on Windows XP and may cause problem with some mobile browsers too.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.