My app is currently receiving the /.well-known/acme-challenge endpoint giving 404.
I have tried adding the following location block above my location / and the Nginx started to give 404. I’m not sure where the acme-challenge location path should point to. /var/www/html is basically empty in my case.
to my Nginx. I can download the file 1234, however, running certbot renew gives
Attempting to renew cert (subdomain.myserver.com) from /etc/letsencrypt/renewal/subdomain.myserver.com.conf produced an unexpected error: Failed authorization procedure. subdomain.myserver.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://subdomain.myserver.com/.well-known/acme-challenge/somerandomkeys [2606:4700:3032::681f:43b1]: "<html>\n<head><title>404 Not Found</title></head>\n<body bgcolor=\"white\">\n<center><h1>404 Not Found</h1></center>\n<hr><center>ngin". Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/subdomain.myserver.com/fullchain.pem (failure)
Without knowing your real domain, it’s total guesswork, but check that your domain’s IPv6 AAAA record is correct, and that your nginx listen stanza is effective for the IPv6 interface.
I mention this because the redacted error you pasted reveals that Let’s Encrypt is connecting to your server over IPv6.
Edit: ah, it’s a Cloudflare IP. That’s probably not the issue then.
If you are using --nginx, be aware that there is an issue relating to Cloudflare which leads to the kind of problem you’re having. To see whether it is relevant to you, try renewing using webroot instead of --nginx:
certbot renew -a webroot -w /var/www/html --dry-run