Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Nov 04, 2013 11:02 am 
Offline

Joined: Mon Nov 04, 2013 10:54 am
Posts: 1
I recently bought a certificate (Thawte SSL 123 Certificate 256 Bit - domain validated) from Hetzner for a domain with www. prefix.

Now i want to add a new certificate so that i also have a secure connection when using no www. prefix.

What is the best action to do so?

Buy the same certificate again and use different virtual host for the domain with www. and one without? How can i accomplish this?

How would my virtualhost file look like? This is the virtualhost file I'm using now:

Code:
<VirtualHost *:80>
        ServerAdmin ***@domain.com

        ServerName domain.com
        ServerAlias www.domain.com

        DocumentRoot /var/www/public/
        ErrorLog /var/www/logs/error.log
        CustomLog /var/www/logs/access.log combined
</VirtualHost>
<VirtualHost *:443>
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/www.domain.com.crt
        SSLCertificateKeyFile /etc/apache2/ssl/www.domain.com.key

        ServerAdmin ***@domain.com

        ServerName domain.com
        ServerAlias www.domain.com

        DocumentRoot /var/www/public/
        ErrorLog /var/www/logs/error.log
        CustomLog /var/www/logs/access.log combined
</VirtualHost>


Top
   
PostPosted: Mon Nov 04, 2013 3:12 pm 
Offline
Senior Newbie

Joined: Sat Oct 01, 2011 10:06 am
Posts: 5
Location: Massachusetts, USA
add domain.com to the ServerAlias


Top
   
PostPosted: Wed Nov 06, 2013 11:02 pm 
Offline
Senior Member

Joined: Wed Mar 03, 2010 2:04 pm
Posts: 111
I assume your cert is only valid for www, so adding domain.com to ServerAlias will serve pages but will give you a certificate error (because the domain "domain.com" won't match the cert domain of "www.domain.com"). That's more a response to yangqi, though, since you indicated you'd be "adding a new cert" so it appears you know you need a new cert. A better bet might have been (or might be) to grab a wildcard certificate that would work with/without your subdomain. Otherwise you'll either need another IP address for the new cert or set up SNI, I think.


Top
   
PostPosted: Thu Nov 07, 2013 8:13 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
If you have mod_rewrite enabled you can always modify the config force www.


Top
   
PostPosted: Thu Nov 07, 2013 8:37 am 
Offline
Senior Member

Joined: Fri Dec 10, 2010 6:21 am
Posts: 144
If you are talking about eg "www.example.com" and "example.com" you would normally get a single certificate with an extra name specified as a "Subject Alternative Name". (The specific example above is actually often provided at no extra cost by the CA.)

That way you do not need separate certificates and do not need to require SNI support or have multiple IPs.


Top
   
PostPosted: Thu Nov 07, 2013 8:48 am 
Offline
Senior Member

Joined: Fri Dec 10, 2010 6:21 am
Posts: 144
haus wrote:
I assume your cert is only valid for www, so adding domain.com to ServerAlias will serve pages but will give you a certificate error (because the domain "domain.com" won't match the cert domain of "www.domain.com"). That's more a response to yangqi, though, since you indicated you'd be "adding a new cert" so it appears you know you need a new cert. A better bet might have been (or might be) to grab a wildcard certificate that would work with/without your subdomain. Otherwise you'll either need another IP address for the new cert or set up SNI, I think.


Afaik, a wildcard cert for *.example.com would not match example.com, so SAN or multiple certs would still be necessary.


Top
   
PostPosted: Thu Nov 07, 2013 11:05 am 
Offline
Senior Member

Joined: Wed Mar 03, 2010 2:04 pm
Posts: 111
hawk7000 wrote:
Afaik, a wildcard cert for *.example.com would not match example.com, so SAN or multiple certs would still be necessary.


Yes, I was apparently remembering seeing a wildcard cert that uses SAN to cover the domain itself. Thank you.


Top
   
PostPosted: Fri Dec 13, 2013 11:01 am 
Offline
Senior Newbie

Joined: Fri Dec 13, 2013 10:37 am
Posts: 6
StartSSL offers free class certs with the root domain + 1 subdomain. If the one you purchased doesn't, it might be worth looking at them.


Top
   
PostPosted: Sat Dec 14, 2013 9:20 pm 
Offline
Senior Member
User avatar

Joined: Thu Nov 24, 2011 12:46 pm
Posts: 139
Location: Mesa AZ
The single certs I get from Namecheap using PositiveSSL Comodo SSL's include both the cn like https://www.example.com https://example.com and Both are included in the cert.

If you use something like https://www.ssllabs.com/ssltest/analyze.html you can get a good analazation of what your server is configured for (The cert, protocols, ciphers) etc... It will show the common names and the alternative names in the top cert section.

I used to use StartSSL until they started getting squirrely saying that any donation page made the site commercial even though it was using PayPal as the processing using it's own SSL certs. The NameCheap ones can be reissued for no extra cost ($25 for StartSSL) and are only around $9 a year).

_________________
Kevin a.k.a. Dweeber


Top
   
PostPosted: Mon Dec 16, 2013 11:47 am 
Offline
Senior Newbie

Joined: Fri Dec 13, 2013 10:37 am
Posts: 6
I wasn't aware StartSSL didn't allow commercial use. Glad I found out about that before using it on a commercial site. I just bought a Comodo from Namecheap. I love them for domain registrations/dns, they're great.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group