My domain is: ai2.metricrat.co.uk (virtual host)
OS/Webserver: Ubuntu 18.04LTS Apache
Server: IONOS VPS, can login as root to shell
A Record: @ 77.68.114.189 (for metricrat.co.uk)
CNAME: ai2 ghs.googlehosted (hosting a new google site)
Cerbot Version: certbot 0.31.0
Depends on the web server.
In Apache, you can use an Alias directive: Alias /.well-known/acme-challenge/ /some/local/folder/
[insert that like below DocumentRoot line]
[folder may need Directory section to difine/allow access to it]
OK time for a simple test.
Place a test-file in that folder.
like: echo "test" >> /home/metricrat/cert/test-file
[after Apache has been restarted to take that change]
Let’s try accessing that file via the Internet: http://ai2.metricrat.co.uk/.well-known/acme-challenge/test-file
If good, then run certbot command again.
If no good, then we need to troubleshoot that…
[fingers crossed]
I have not changed the virtual host settings for ai2.metricrat.co.uk from the last test....
sudo apachectl -S
VirtualHost configuration:
*:443 is a NameVirtualHost
default server ai2.metricrat.co.uk (/etc/apache2/sites-enabled/ai2.metricrat.co.uk-le-ssl.conf:2)
port 443 namevhost ai2.metricrat.co.uk (/etc/apache2/sites-enabled/ai2.metricrat.co.uk-le-ssl.conf:2)
port 443 namevhost burbush.co.uk (/etc/apache2/sites-enabled/burbush.co.uk-le-ssl.conf:2)
alias www.burbush.co.uk
port 443 namevhost carter-computing.co.uk (/etc/apache2/sites-enabled/carter-computing.co.uk-le-ssl.conf:2)
alias www.carter-computing.co.uk
port 443 namevhost www.cyberama.co.uk (/etc/apache2/sites-enabled/cyberama.co.uk-le-ssl.conf:2)
alias cyberama.co.uk
port 443 namevhost metricrat.co.uk (/etc/apache2/sites-enabled/metricrat.co.uk-le-ssl.conf:2)
alias www.metricrat.co.uk
port 443 namevhost tsah.co.uk (/etc/apache2/sites-enabled/tsah.co.uk-le-ssl.conf:2)
alias www.tsah.co.uk
*:80 is a NameVirtualHost
default server localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ai2.metricrat.co.uk (/etc/apache2/sites-enabled/ai2.metricrat.co.uk.conf:1)
port 80 namevhost burbush.co.uk (/etc/apache2/sites-enabled/burbush.co.uk.conf:1)
alias www.burbush.co.uk
port 80 namevhost carter-computing.co.uk (/etc/apache2/sites-enabled/carter-computing.co.uk.conf:1)
alias www.carter-computing.co.uk
port 80 namevhost www.cyberama.co.uk (/etc/apache2/sites-enabled/cyberama.co.uk.conf:1)
alias cyberama.co.uk
port 80 namevhost metricrat.co.uk (/etc/apache2/sites-enabled/metricrat.co.uk.conf:1)
alias www.metricrat.co.uk
port 80 namevhost tsah.co.uk (/etc/apache2/sites-enabled/tsah.co.uk.conf:1)
alias www.tsah.co.uk
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: MODSEC_2.5
Define: MODSEC_2.9
User: name="www-data" id=33
Group: name="www-data" id=33
<location "/.well-known/acme-challenge/">
Alias "/home/metricrat/cert/"
DocumentRoot "/home/metricrat/cert/"
</location>
or maybe without the last slash and no quotes...
<location /.well-known/acme-challenge>
Alias /home/metricrat/cert
</location>