Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
Your Apache VirtualHost for port 80 is redirecting all requests to HTTPS and your HTTPS VirtualHost redirects the acme-challenge request to your login page. You need the server to respond with the acme challenge token value instead. There are many ways to correct this. One is to update your rewrite rules by adding this line immediately afterRewriteEngine on
RewriteRule ^/\.well-known/.+ - [END]
This will prevent the /.well-known/acme-challenge/TokenValue request from being redirected to your https server.
As long as your DocumentRoot for the http VirtualHost is correct the cert renewal should be fine.
I tested both suggestions one after the other but it didn´t work.
I checked the DocumentRoot. In the files 000-default.conf and default-ssl.conf it was '/var/www/html'. I changed the path in '/var/www/nextcloud' and tried again both suggestions.
I get again the same error message
More of the same.
Try each of those (again); But this time create a test text file in the expected challenge location.
And see if it can be accessed directly from the Internet. mkdir -p /var/www/nextcloud/.well-known/acme-challenge echo "test" > /var/www/nextcloud/.well-known/acme-challenge/Test_File-1234 http://midgard.crabdance.com/.well-known/acme-challenge/Test_File-1234
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for midgard.crabdance.com
Using the webroot path /var/www/nextcloud for all unmatched domains.
Waiting for verification...
Cleaning up challenges
The dry run was successful.
But why does it only work with those additionally parameters?