Let-encrypt on second site blocks first site

Good day, trust everyone is well

My setup is a multi-tenant system ( 2 sites ) using sub-domains.

Procedure followed:

Manual install for V12.29

bench new-site name1.site --admin-password ------------------
bench --site name1.site enable-scheduler
bench --site name1.site install-app erpnext
bench start
sudo bench setup production erpnextuser
sudo supervisorctl stop all
sudo supervisorctl start all
bench config dns_multitenant on
bench setup add-domain --site name1.site name1.mydomain.com
bench setup nginx
bench setup reload-nginx

Then I enabled 2FA.

Enabled https with–

sudo apt-get remove certbot
sudo apt install snapd
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx

Could access the system with : name1.mydomain.com
Configured the system i.e. item masters, suppliers …etc

The I built my second site -----

bench new-site name2.site --admin-password ----------
bench --site name2.site enable-scheduler
bench --site name2.site install-app erpnext
bench setup add-domain --site name2.site name2.mydomain.com
bench setup nginx
bench setup reload-nginx

Enabled https on second site—
sudo certbot --nginx

I can access the second site with : name2.mydomain.com

But now when I try and access the first system, I get two errors, sometimes the one, sometimes
the other—
404 Not found Nginx

or

Site Can’t be reached
ERR_CERT_COMMON_NAME_INVALID

I can ping both sites.

Some assistance/advise would be most kind.

Additional observation—

My procedure that I followed above was -

Install site 1
Install cert for site 1

Install site 2
Install cert for site 2

I now did it another way –

Install site 1
Install site 2

Install cert for site 1
Install cert for site 2

And that works.

Keep in mind, these are certs for the individual sites. Not a wildcard cert.

I would like to try a wildcard cert but I shall not let this topic digress. I shall make another
topic.

2 Likes