Letsencrypt error when running command "sudo certbot certonly -a nginx -d [domain]"

Hello everyone, I am following a tutorial on multi tenancy from ERPGulf on youtube. I have been trying to learn out multi tenancy for a week now.
I created site1, ran letsencrypt, DNS etc and it is running well. When I came to the second site, I created site2 and installed ERPNext on it and added a subdomain pointing to the server IP. According to the tutorial the next step is to get a certificate for my site2 by running “sudo certbot certonly -a nginx -d [site2 doman]”. However, when I run this I get the following error message:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for [site2 domain]

Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: [site2 domain]
Type: unauthorized
Detail: [IP Address]: Invalid response from http://[site2 subdomain]/.well-known/acme-challenge/Dy-1OUWRenF4ArkoyLAjRfavy1cRUDpMvj082AmTgNI: 404

Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.

Any help resolving this or direction to better information on multi tenancy will be greatly appreciated.

Hi @Apeiron

Can you confirm if you’re able to reach site2.domain before attempting to install the certificate ?

Kind regards,

Hi @wale yes, I’m able to reach it. It’s currently still pointing to the default site, but the address is working.