Completely stuck with certbot 404 message

Hi there!

Unfortunately I am completely stuck with testing the certificates renewal process. Here are the main coordinates:

My domain is: wiki.sdidev.com & sdidev.com
I ran this command: sudo certbot renew --dry-run
It produced this output:

...
Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems:
  Domain: wiki.sdidev.com
  Type:   unauthorized
  Detail: 65.83.236.94: Invalid response from http://wiki.sdidev.com/.well-known/acme-challenge/gtiocHekTTMz7JxGla5X-NIKUZvPgz3aMoTy1zqkRGk: 404
...

My web server is: Apache/2.4.58 (Ubuntu)
The operating system my web server runs on is: Ubuntu 24.04
My [hosting] provider, is: easyname.at (only using dns-server here)
I can login to a root shell on my machine: yes

I'm using a control panel to manage my site: no - I am running a home server, the A-record (editable) of my DNS server at easyname points to my fixed IP

The version of my client is: 2.9.0

The infrastructure is:

  • DNS-server is at easyname (has unfortunately no API for challenge) and points via A-record to my fixed IP
  • there a Nginx Reverse Proxy Manager is running, delivering the URI (wiki.sdidev.com) to a server (it's a Proxmox VM)
  • The VM runs Ubuntu 24.04 and a LAMP stack

What I have done so far:

  • installed DokiWiki (works fine)
  • created a certificate for wiki.sdidev.com & sdidev.com (it's working fine too)
  • routed through the Nginx reverse proxy manager by using this certificate (ok)
  • created configs for VirtualHosts *.80 as well as *.443
  • created a letsencrypt.conf
    These configs have aliases for the acme-challenge like this:
...
    Alias "/.well-known/acme-challenge/" "/var/lib/letsencrypt/well-known/http-challenges/"
    <Directory "/var/lib/letsencrypt/">
     	Options Indexes FollowSymLinks
        
        AllowOverride None
        
        ## for test
        Require all granted					
        
        ## for production
        # Require method GET POST OPTIONS 	
    </Directory>
...
  • path /var/lib/letsencrypt/well-known/http-challenges/ is created, accessible for www-data
  • nevertheless no success with sudo certbot renew --dry-run
  • created a test.htm within this path for test purposes => cannot access

So, I guess it is a problem to access the required path, but after hours I don't have a glue where the glitch may be.

Here is my /etc/letsencrypt/renewal/wiki.sdidev.com.conf file

# renew_before_expiry = 30 days
version = 2.9.0
archive_dir = /etc/letsencrypt/archive/wiki.sdidev.com
cert = /etc/letsencrypt/live/wiki.sdidev.com/cert.pem
privkey = /etc/letsencrypt/live/wiki.sdidev.com/privkey.pem
chain = /etc/letsencrypt/live/wiki.sdidev.com/chain.pem
fullchain = /etc/letsencrypt/live/wiki.sdidev.com/fullchain.pem

# Options used in the renewal process
[renewalparams]
account = c1bb1db9c969eaab5d0ec62b2ee85d0b
authenticator = apache
server = https://acme-v02.api.letsencrypt.org/directory
key_type = ecdsa
installer = apache

Thank's for all hints in advance!
orville

I don't see any A record for that domain right now. See test result: Let's Debug

I see an A record for this one
sdidev.com. 0 IN A 54.163.253.203

Should the wiki subdomain have the same IP? Because the one in the error msg is different. It is fine to be different ... just trying to understand more of your configuration

3 Likes

Thanks,

Sorry, wrong installation - it's all sdidev.net now and the digits are transposed it's 83.65.239.94 (copied now, not memorized :slight_smile:

Do you still need help with your certs?

If so, please show a command that fails or describe the problem. Thanks

2 Likes

Yes, still the same problem - tried it on another domain too, same results. Certbot always results in 404 can't access the http://[whateverdomainItried]/.well-known/acme-challenge/xyz
I can't get the point where the server config files including

...
Alias "/.well-known/acme-challenge/" "/var/lib/letsencrypt/well-known/http-challenges/"
    <Directory "/var/lib/letsencrypt/">
     	Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted					
    </Directory>
...

are overwritten or why.

  • tried various approaches I found online for ubuntu
  • tried even using no .htaccess in /var/www/html
    but in vain.
    Google KI answer was not helpful too :smile:

Unfortunately I am missing good step by step docs on that, for newbies like me.

Would you show the command you used and the error shown by Certbot? Because the domain name in your first post no longer has a DNS A record so cannot work for an HTTP Challenge.

And, as long as we're talking about Apache, what does this show

sudo apache2ctl -t -D DUMP_VHOSTS
3 Likes

Hi,
thank you so much for your patience!

Here my certbot command (now the wiki.sdidev.net machine) and the answer copy & paste:

$ sudo certbot renew --dry-run


Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/wiki.sdidev.net.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for wiki.sdidev.net

Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems:
  Domain: wiki.sdidev.net
  Type:   unauthorized
  Detail: 83.65.239.94: Invalid response from http://wiki.sdidev.net/.well-known/acme-challenge/rvPlDJ5hoj3flRSKVMvPb7MGarHQFVCdn_X-ln6Er84: 404

Hint: The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot. Ensure that the listed domains point to this Apache server and that it is accessible from the internet.

Failed to renew certificate wiki.sdidev.net with error: Some challenges have failed.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
All simulated renewals failed. The following certificates could not be renewed:
  /etc/letsencrypt/live/wiki.sdidev.net/fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)
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.

and here the apache dump

$ sudo apache2ctl -t -D DUMP_VHOSTS

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443                  sdidev.net (/etc/apache2/sites-enabled/sdidev.net-le-ssl.conf:2)
*:80                   sdidev.net (/etc/apache2/sites-enabled/sdidev.net.conf:1)

THX in advance

I see you switched from .com to .net.

But, requests to wiki.sdidev.net are handled by an openresty server not Apache. What is that about? Seems like maybe NPM isn't sending the requests to Apache maybe?

Request to: wiki.sdidev.net/83.65.239.94, Result: [Address=83.65.239.94,Address Type=IPv4,Server=openresty

The above Apache config may be missing a ServerAlias for the wiki subdomain. Please show contents of that conf file

2 Likes

Well, now I am completely puzzled :zany_face:

  • Server runs apache, that's what I've installed
  • but requests from the Internet are routed via Nginx Reverse Proxy Manager (this one: https://nginxproxymanager.com/ ) to distribute different urls to different servers (some Proxmox VMs)

When I am typing in a non-existing url like http://wiki.sdidev.net/nothere, then the 404 message comes from apache:

Not Found

The requested URL was not found on this server.
Apache/2.4.58 (Ubuntu) Server at wiki.sdidev.net Port 443

but interestingly both http:// as well as https:// are showing Port 443 (did not force ssl in the reverse proxy )

But when calling http://wiki.sdidev.net/.well-known/acme-challenge/ then the result is

404 Not Found
openresty

Things are becoming weirder and weirder ...

Yeah, your best option is the NPM support forums. Getting all that working can take some effort that is well beyond what we handle here.

2 Likes

Well, maybe I will install everything from scratch to find out where and when the problem starts.
Had the impression the combination of Nginx Reverse Proxy and Apache is used relatively often. Nevertheless most blogs, tutorials etc are referring to an API service like cloudflair, I cannot use unfortunately, to handle letsencrypt.

Anyhow, if I am able to find a solution in time, I will gladly return to share the How-To :slight_smile:

1 Like

The best place to post that is the NPM forum ! :slight_smile:

Our main focus is helping people get and use Let's Encrypt certs. But, configuring complex server and container integration is beyond what we (usually) help with. Especially NPM which can be exceedingly difficult to debug if it goes wrong.

2 Likes

If you're looking for a tool that sits in front of several sites to direct traffic (and automatically handles HTTPS), you might want to look at using Caddy instead of NPM.

3 Likes

Thanks!
look promising, I'll have a close look at this.