My certificate does not want to renew with Let’s encrypt.
sudo certbot certonly --dry-run --webroot -w /srv/www/htdocs/mydomain -d "www.mydomain.ca"
[sudo] password for root:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Simulating a certificate request for www.mydomain.ca
Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
Domain: www.mydomain.ca
Type: unauthorized
Detail: 2a02:c206:2104:354::1: Invalid response from http://www.mydomain.ca/.well-known/acme-challenge/0C9WNMVOdTU2sXMJ__XY7olXz8oNtaemwhY5wQv9A0Y: 400
Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.
Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
I’m trying to resolve this issue by debugging it using curl:
url -LI http://www.mydomain.ca
HTTP/1.1 301 Moved Permanently
Date: Thu, 10 Apr 2025 22:15:25 GMT
Server: Apache
Location: https://www.wrongsite.com/error/HTTP_BAD_REQUEST.html.var
Content-Length: 267
Connection: close
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 200 OK
Date: Thu, 10 Apr 2025 22:15:25 GMT
Server: Apache
Vary: accept-language,accept-charset
Strict-Transport-Security: max-age=31536000;
Upgrade: h2,h2c
Connection: Upgrade
Accept-Ranges: bytes
Content-Type: text/html; charset=utf-8
Content-Language: en
And does shows that firstly wrongsite is accessed. But mydomain is configured to with a vhost file for port 80 and a vhost for port 443. The vhost for port 80 is only redirecting traffic to 443:
<VirtualHost www.mydomain.ca:80>
ServerName www.mydomain.ca
ServerAlias mydomain.ca
Redirect / https://%{SERVER_NAME}
</VirtualHost>
When accessing the domain in the browser this works as expected.
I’m lost as to why wrongsite is used with curl (though that explains why LE is not working).