LetsEncrypt is failing with the following message:
Apache website : Missing Apache block for HTML directory /var/www/domain.com/public_html
This is a CentOS 7 system with a standard Virtualmin install which set the home directory to /home instead of /var/www. I’ve looked at the Apache entries and the user/group home directories and they are all set to /home and not /var/www. How do I fix this?
It sounds like you had an active server before Virtualmin was installed. If that’s not it, a little more background info about your server might give a clearer picture.
You can try customizing paths (Apache document root etc.) with Virtualmin’s server template, among other settings. But /home is pertinent to other things besides the web server.
You haven’t explained why your homes are in /var/www. That’s not the default in a Virtualmin system. Sounds like you haven’t configured Virtualmin to work the way you want it to work…it takes a bunch of config changes to move homes to /var/www (and a different Apache than the one we provide, if you’re using suexec/fcgid).
I used Virtualmin’s backup from a CentOS 6 system which used /var/www/user/ as the home directory and restored it to a CentOS7 system which uses /home/user/ as the home directory. Both use public_html as the web directory. I have done this before without any issue beyond Webalizer getting lost.
Virtualmin properly set the new user directory on the ContOS7 system. Apache conf was corrected to /home from /var/www. Yet, LetsEncrypt says:
“However, the Let’s Encrypt service requires that your ownership of the certificate domain be validated by checking that this system hosts the website for the domain. This is done by placing a small temporary file under the website’s document directory /var/www/user/public_html.” which is the old directory from the old server for this moved virtualhost.
So, I grepped for that path and luckily did it on /etc/webmin and up popped virtual-server/domains/###############. I edited that file correcting the path. Fought with some certbot instances that were running and after all was cleaned up, LetsEncrypt did update the cert.
I was surprised that Virtualmin made the path corrections in Apache, but did not correct the home path in this config file.
Sounds like a bug/oversight. It’s a pretty rare thing for any Virtualmin system to have homes in /var/www, so I guess Jamie didn’t think of it when adding restore of Let’s Encrypt config.