404 error Nextcloud setup

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



  • 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

    Not Found


    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?

1 Like

Yes, one: "APACHE"
Please show the output of:
apachectl -S

1 Like

Hi @Operations

your domain name is required if you want help.


Not necessary anymore...

root@cloud:~# apachectl -S
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"
User: name="www-data" id=33
Group: name="www-data" id=33

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
1 Like

There you see your problem.

Two different vHosts with the same port and the same domain name.

Merge both in one, remove the other.


Could you be so kind and to tell me how to do this? :slight_smile:

And looking at the HowTo, how did this happen? Any idea? (To learn from my mistakes...)

And the different DocumentRoot is not the cause and of a problem ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.