[Debian 10 / Nextcloud 21] Let's Encrypt issue

Hello everybody :slight_smile:

I am trying to finish this HowTo:

But my problem is the Let’s Encrypt command doesn’t work. (certbot --apache)

The error is get is:

root@cloud:/var/www/nextcloud# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?


1: cloud.DOMAIN.nl


Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter ‘c’ to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for cloud.DOMAIN.nl
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. cloud.DOMAIN.nl (http-01): urn:ietf:params:acm e:error:unauthorized :: The client lacks sufficient authorization :: Invalid res ponse from http://cloud.DOMAIN.nl/.well-known/acme-challenge/Mycrj8dvNBtG-vV53 0zHCUCbV61uLTaex_dBSuajQWU [..*.213]: “\n\n404 Not Found\n\n

Not Found

\n<p”

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: cloud.DOMAIN.nl
    Type: unauthorized
    Detail: Invalid response from
    http://cloud.DOMAIN.nl/.well-known/acme-challenge/Mycrj8dvNBtG-vV530zHCUCbV 61uLTaex_dBSuajQWU
    [..*.213]: “\n\n404 Not
    Found\n\n

    Not Found

    \n<p”

    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 am 100% sure i have an A record in my domain DNS. I use the same name for a different working Nextcloud ubuntu setup (which is of course off at the moment).
So because i use the same name and internal IP address, i also know there is no firewall issue. I also tried a different hostname (with newly setup A record) and different external and internal IP. I keep getting the same error…

I have followed the HowTo to the letter, but i think something is still not right…

The HowTo is pretty straight forward so to be honest i feel a bit stupid… But i just can’t seem to get it right…

I am pretty novice when it comes to linux (so please be very gentle :stuck_out_tongue: ), but i do know my way around networks/firewalls etc.

Any ideas?

Hi @Operations

You left your IP address in your post… Maybe you wanna change that.

I tested it and it comes up with the Apache Default page. I tried it via IP address, and via domain name. (this one I didn’t find in your post) So if the IP address in your post actualy is the server you are working on, it is not a DNS issue.

Check your VirtaulHost config file.

Did you specify the Servername directive correctley in the config file?

ServerName cloud.domain.tld

Is the VirtualHost enabled?

a2ensite vitrualhost.conf
1 Like

ServerName = cloud.DOMAIN.nl is correct.

a2ensite nextcloud
a2enmod rewrite headers
systemctl restart redis apache2

When i do that it replies with “already enabled” . (Because i already did it… )

VirtualHost configuration:
*:80 is a NameVirtualHost
default server cloud.DOMAIN.nl (/etc/apache2/sites-enabled/000-defaul t.conf:1)
port 80 namevhost cloud.DOMAIN.nl (/etc/apache2/sites-enabled/000-def ault.conf:1)
port 80 namevhost cloud.DOMAIN.nl (/etc/apache2/sites-enabled/nextclo ud.conf:1)
ServerRoot: “/etc/apache2”
Main DocumentRoot: “/var/www/html”
Main ErrorLog: “/var/log/apache2/error.log”
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: “/var/run/apache2/apache2.pid”
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name=“www-data” id=33
Group: name=“www-data” id=33
root@cloud:~#

nano /etc/apache2/sites-available/nextcloud.conf

I entered a different DocumentRoot (/var/www/nextcloud)… I looks like it is not saving that.

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request’s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName cloud.DOMAIN.nl

    ServerAdmin webmaster@DOMAIN.nl
    DocumentRoot /var/www/nextcloud

Should this be one line???

port 80 namevhost cloud.DOMAIN.nl (/etc/apache2/sites-enabled/000-def ault.conf:1)
port 80 namevhost cloud.DOMAIN.nl (/etc/apache2/sites-enabled/nextclo ud.conf:1)

Did you restart apache after you made the changes?

systemctl restart apache2

@bb77 ,

Yes multiple times and also rebooted the virtual machine.

To be honest, I can’t really figure out your config. It looks like there is a lot missing. Was this created with Webmin or a similar tool? The link to the tutorial you linked also seems to be broken.

Maybe it’s easier to start again from scratch…?

LearnLinux.tv has a good tutorial, if you like to follow a video tutorial. It’s for Ubuntu, but should work on Debian too. The guide is relatively basic, but includes everything to get you going. The channel is also a good starting point to learn a few basic linux skills btw :slight_smile:

https://www.youtube.com/watch?v=y4dtcr2NL5M
…and the corresponding commands:
https://wiki.learnlinux.tv/index.php/Nextcloud_-_Complete_Setup_Guide

And here you can find a very comprehensive guide with nginx:
https://www.c-rieger.de/nextcloud-installationsanleitung/
…or Apache:
https://www.c-rieger.de/nextcloud-21-mit-apache2-fast-track/

Both are in German but you should be able to get around it, with Google translate, not much text to translate anyways :wink:

Hope that helps…

1 Like