0

I installed lets encrypt using certbot when I go to the www.domain.com I get this site is not secure error

Found the following certs:
  Certificate Name: example.com
    Domains: example.com
    Expiry Date: 2023-05-25 15:01:00+00:00 (VALID: 70 days)
    Certificate Path: /etc/letsencrypt/live/example.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/example.com/privkey.pem
  Certificate Name: www.example.com
    Domains: www.example.com
    Expiry Date: 2023-06-13 16:14:03+00:00 (VALID: 89 days)
    Certificate Path: /etc/letsencrypt/live/www.example.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/www.example.com/privkey.pem

Apache SSL conf file

<VirtualHost *:443>
ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example/public_html/public
SSLEngine                on
<Directory /var/www/example/public_html/public>
         Options +FollowSymLinks
         DirectoryIndex index.php
         AllowOverride All
         Require all granted
         Order allow,deny
         Allow from all
     </Directory>
SSLCertificateFile       /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile    /etc/letsencrypt/live/example.com/privkey.pem
Include  /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

How can I make it work for www domain also?

2
  • Why don't you use a LetsEncrypt certificate which contains both domains? Commented Mar 16, 2023 at 13:12
  • 1
    @A.B sorry it should be 2.4 Commented Mar 16, 2023 at 13:27

1 Answer 1

1

You need to get one certificate with correct Subject Alternate Name.

You can delete the www.example.com and example.com certificates, and request a new for example.com and wwww.example.com.

2
  • How can I delete only www certificate? because If I delete both of them, site will be broken. Can I first delete the www cert. and then convert example.com to wildcard? Commented Mar 16, 2023 at 13:21
  • You don't need wildcard. You need a cert with two names. certbot delete --certname www.example.com should do the trick. And yes; the site will be broken for some seconds when you switch over anyway.
    – vidarlo
    Commented Mar 16, 2023 at 13:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .