Troubleshooting HTTP for Let's Encrypt

I would like to suggest going through the list below on a virtual server that is not proxy through Cloudflare.
By the looks of it, you have problems with a re-direction and IPv6 not properly set up.
This is going by the errors you mentioned.

This can be for a subserver.mydomain.com or mydomain.com.

In Virtualmin > Subserver.mydomain.com > Server Configuration > Change IP Address:
Make sure your IPv4 and IPv6 address is correct.

In Virtualmin > Subserver.mydomain.com > Server Configuration > Website Redirects
Remove all redirects.

In Virtualmin > Subserver.mydomain.com > Server Configuration > SSL Certificate
Install your Let’s Encrypt SSL Cert.

Let us know what happens.

Hy @cyberndt, I appreciate you looking at this. I’ll try and clarify:

The subdomain for Webmin, webmin.mydomain.com, is able to obtain a certificate without problem. It is not proxied through Cloudflare.

I’m not using IPv6 at all. Not sure why that message came up for me the other day, but that at least has gone away.

I went ahead and created a test.mydomain.com account that is not proxied through Cloudflare. Before I created it, I verified that it had the correct IPv4 address.

And right there during creation it is getting a 404 error to the .well-known folder.

I checked for redirects, and there weren’t any.

But, I learned the reason it receives that error is because it is redirecting to mydomain.com/.well-known/acme-challenge from test.mydomain.com/.well-known/acme-challenge. (Notice it went from the subdomain to the root domain.) I figured this out when I performed a “Test connectivity” check during the SSL creation again and then attempted to load the site directly.

That gets us closer to the root cause. I’ll look into it more tomorrow. If you have any ideas in the meantime, I’d love to hear them.

That doesn’t sound like a redirect. If it is simply serving the wrong site, it sounds like an Apache VirtualHost misconfiguration. Apache decides which site to serve based on an algorithm nobody understands, but if you have mixed * and IP VirtualHosts, Apache will serve something you didn’t expect. Similarly, if you have IPv6 config anywhere in the Apache VirtualHosts but not for every domain, you’ll get surprises.

Some things to look at are covered in our Web Troubleshooting FAQ: Website Troubleshooting – Virtualmin

There are all sorts of ways you can end up there. Restoring a domain that uses * into a server that is using IP based VirtualHosts, installing any of a number of web apps from system packages can do weird things to VirtualHosts (so don’t do that), IPv6 misconfiguration in Virtualmin or having it turned on and then disabling it later without cleaning up the configs that were created, etc.

Apache has bizarre, absolutely incomprehensible, virtual host selection rules. So…you have to take away all possible ways it can misinterpret your intentions because it will absolutely misinterpret you if there’s any way for it to.

2 Likes

This totally made me chuckle. Thanks! Taken to heart and I’ll resume troubleshooting tomorrow.

1 Like

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