I will freely admit my ignorance - or perhaps enough knowledge to be dangerous.
I have a subdomain http://db.<mydomain>.com
that serves the phpMyAdmin utility. It's currently in a directory with an Apache directive to require a valid-user from .htaccess which made sense at the time, because I don't want to expose the phpMyAdmin login page to the general public.
The problem this created was trying to use cert-bot to create SSL certs for my site, it can't validate the ACME challenge because the challenge can't get past the .htaccess restriction.
How can I simultaneously serve this subdomain over https while also requiring an additional layer of security before a user can see the phpMyAdmin login page?
<VirtualHost *:80>
ServerName db.<mydomain>.com
ServerAlias www.db.<mydomain>.com
DocumentRoot /var/www/subdomains/db/phpMyAdmin
</VirtualHost>
<Directory "/var/www/subdomains/db">
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all
AuthType Basic
AuthUserFile "/var/www/.htpasswd-users"
require valid-user
</Directory>