SSL not working for www domains


#1

I’ve used the letsencrypt client on an apache host, in order to generate certificates for a couple of vhosts.

For the vhosts the following pattern is true:

Browser request for http://mysite.com are redirected to the https url. The browser accepts the cert. Padlock is green. Everything works just fine.

However…

For http://www.mysite.com the browser displays a loud warning about the cert. Chrome gives: NET::ERR_CERT_COMMON_NAME_INVALID

The warning also appears if I navigate directly to the same www-prefixed domain, with ‘https’.

The difference is in the ‘www’.

How use the letsencrypt client to generate certs that work for the ‘www’ prefixed domain?


#2

Add a -d www.yoursite.com switch on the command line when you ran the client… It doesn’t automatically add the www-subdomain… Why would it? :wink:


#3

Hi Osiris.

I did use ‘-d’, while passing in the www prefix.
This is the command I used:

/letsencrypt-auto certonly --keep-until-expiring --webroot -w /var/www/mysite.com -d mysite.com,www.mysite.com


#4

You need to use multiple -d flags, not a comma separated list.


#5

Thanks.

I’m now getting an error while trying to generate certs. But I think this is an issue unrelated to my initial question. So I’m going to do a little more homework. Then if I haven’t solved the new issue I might start another thread.

Thank you.


#6

@cool110 Actually both multiple -d flags or a comma-separated list should work.