i am trying to issue an alternate domain name for an existing certificate.
My setup has a frontend NGINX server that is redirecting traffic to various other internal systems.
So i maintain my LetsEncrypt certificates on the NGINX frontend. This works for all domains and subdomains but not for one. There the challenge fails.
I could once issue the cert by stopping nginx and running the standalone challenge webserver. Thus its saying "renew" certificate now.
So i wonder what am i doing wrong. I can create certificates for all other domains but not for this particular one.
Since incoming traffic is routed to some other server via NGINX i am not even sure if this is the reason. I guess the certbot cannot put its challenge files on a different server. How could i solve that?
The standalone method does only work if i stop and start the nginx by using post and pre deploy hooks. However the hooks seem not to be working fine either as they do not stop nginx in a timely manner as some workers process seems to wait for terminating.
I tried this to test (using certbot 1.11.0)
certbot renew --dry-run
The following simulated renewals failed:
/etc/letsencrypt/live/nginxhostname.domain.tld/fullchain.pem (failure)
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
I could fix the issue but i had to give the subject alternative name its own IP adress on the nginx proxy server. When the new IP was brought up on the proxy and it was given a new section in nginx.conf it was working very well.
What i basically added to nginx.conf was:
upstream subdomain.domain.tld {
server 1.2.3.4:80;
}
1.2.3.4 is the internal IP of the target machine
5.6.7.8 is the public IP on the frontend nginx proxy machine it is listening for incoming traffic for the subdomain
After nginx was running fine with that configuration i could issue my cert with:
However i am wondering if there is no other way than adding a new IP to each subdomain. Because if you have like 10 subdomains you are wasting 10 IPs on the frontend. Maybe there is a way that is less of a waste of IPs ?
Whats funny:
i can issue certificates for www.domain.tld and domain.tld under the same IP adress. But when i add a subdomain to the same domain.tld it needs a different IP.
Does anyone have an idea what i´m doing wrong?
Maybe someone could paste a nginx.conf Sniplet for a working proxy and multiple subdomains under one certificate that is not causing certbot challenge failures.