I ran this command: sudo /etc/letsencrypt/maudach-cloud.sh
It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Obtaining a new certificate Performing the following challenges: http-01 challenge for maudach-cloud.ddns.net Using the webroot path /var/www/html/owncloud for all unmatched domains. Waiting for verification⌠Cleaning up challenges Running post-hook command: service nginx reload Hook command âservice nginx reloadâ returned error code 1 Error output from service: nginx: unrecognized service
To fix these errors, please make sure that your domain name was entered correctly and the DNS A record(s) for that domain contain(s) the right IP address.
My web server is (include version): Donât know
The operating system my web server runs on is (include version): Raspbian (latest version)
My hosting provider, if applicable, is: RaspberryPi at Home
I can login to a root shell on my machine (yes or no, or I donât know): yes
Iâm using a control panel to manage my site (no, or provide the name and version of the control panel): Donât know
Letâs Encrypt is trying to reach out to http://maudach-cloud.ddns.net/.well-known/acme-challenge/DRwgE4m4Kwy_UlyNWz2l7PLV-sKO1VvlxYCuL-tLSS0 to retrieve the challenge file, but your server (or something in the way) is returning a 404 error instead. I actually get a timeout when I try that myself, is 91.66.235.116 still the correct IP?
$ curl -v http://maudach-cloud.ddns.net/.well-known/acme-challenge/DRwgE4m4Kwy_UlyNWz2l7PLV-sKO1VvlxYCuL-tLSS0
* About to connect() to maudach-cloud.ddns.net port 80 (#0)
* Trying 91.66.235.116...
* Connection timed out
* Failed connect to maudach-cloud.ddns.net:80; Connection timed out
* Closing connection 0
curl: (7) Failed connect to maudach-cloud.ddns.net:80; Connection timed out
What are the contents of /etc/letsencrypt/maudach-cloud.sh? if you place a test file in /var/www/html/owncloud/.well-known/acme-challenge, are you able to load that from a connection external to your network, e.g. your phone, not on wifi?
So I assume, this redirection is somewhere missing.
Besides, if I compare the two clouds, I am missing the âletsencryptâ folder at â/var/www/â, which is there with lots of contents for the âworkingâ cloud.
Currently, when I run the following command âcertbot certonly --webroot -w /var/www/html/owncloud/ -d maudach-cloud.ddns.netâ, I receive the following error. (a command like âcertbot certonly --webroot -w /var/www/html/owncloud/ -d maudach-cloud.ddns.net/owncloudâ is not working,as it is malformatted):
To fix these errors, please make sure that your domain name was entered correctly and the DNS A record(s) for that domain contain(s) the right IP address.
Technically this is not true ;), your owncloud is located at /var/www/html/owncloud but this link doesn't point to it https://huberconsulting.ddns.net/owncloud.
I suppose the DocumentRoot defined for this domain is /var/www/html and it should be /var/www/html/owncloud so you should change this in your VirtualHost definition or in your apache2.conf file (I don't know if you are using Virtual Host or how did you configure your apache web server).
It is not important for the tests but just in case, there is a typo, it is acme-challenge instead of acme-challange.
The command you wrote and the error message doesn't match, I'm guessing you are trying this command:
So... I think the only problem here is that you should define the right DocumentRoot directive for domain maudach-cloud.ddns.net pointing to /var/www/html/owncloud in your apache conf, where you should change it?... it will depend on how you have configured it but as you have 2 instances and the other one is working fine you should take a look to the conf of the working one.
Blockquote
I suppose the DocumentRoot defined for this domain is /var/www/html and it should be /var/www/html/owncloud so you should change this in your VirtualHost definition or in your apache2.conf file (I donât know if you are using Virtual Host or how did you configure your apache web server).
Since I did not change anything in my apache2.conf file, I assume it must be the files in "sites-available" folder, right? In there are 3 files, which are 000-default.conf, default-ssl.conf and owncloud.conf. All of those are active with command a2ensite. I adjusted 000-default.conf and default-ssl.conf.
If I now browse to https://maudach-cloud.ddns.net, I am redirected to the owncloud login page. So this works now.
However, I still receive an error if I run the certbot command you mentioned, which is certbot certonly --webroot -w /var/www/html/owncloud/ -d maudach-cloud.ddns.net
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for maudach-cloud.ddns.net
Using the webroot path /var/www/html/owncloud for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Unable to clean up challenge directory /var/www/html/owncloud/.well-known/acme-challenge
Running post-hook command: service apache2 reload
Failed authorization procedure. maudach-cloud.ddns.net (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://maudach-cloud.ddns.net/.well-known/acme-challenge/bHxTnDWRwDGxqhpp3a4-qCMQs36NQTbTG6uid-cFuJE
@sahsanu Can you help me with this as well? Anything more you would need?
thanks first of all for your help. Really appreciate it.
I did as you told me and I cannot reach the file. Interesting though, that I can access the file if I use the link via https. Then the test content appears.
Output of grep -ri well-known /etc/apache2/* as follows:
/etc/apache2/sites-available/000-default.conf: Alias /.well-known/acme-challenge/ /var/www/letsencrypt/.well-known/acme-challenge/
/etc/apache2/sites-available/000-default.conf: Alias /.well-known/acme-challenge/ /var/www/letsencrypt/.well-known/acme-challenge/
/etc/apache2/sites-available/000-default.conf: <Directory "/var/www/letsencrypt/.well-known/acme-challenge/">
/etc/apache2/sites-available/000-default.conf: RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
So it is still not working. I still get the same 404 error. However, as I said, with https it is working. Can it be, that I accidentally created some sort of a âhttpsâ only linkage or so?
I hope we find the root cause, as I do not plan to install the whole thing again.
By the way, this is also part of my .htaccess file in the owncloud folder:
do I need this RedirectMatch? I think I copied this from some German tutorial. Or can we make it work âas usualâ via the .../owncloud/.well-known/acme-challenge folder? Then both clouds and the vertont commands would work the same way.
Now it is me, being on the road, so I havenât checked it yet. Will do, when at home.
That RedirectMatch is only there to return a 404 error if the url requested doesn't contain 43 ascii characters so you can remove it if you want.
If you want that the challenge goes to your document root /var/www/html/owncloud/... then you need to edit your 000-default.conf file and remove a few lines: