Global Apache Alias, ignoring virtual hosts
You can try to add this before all your virtual host :
Alias /.well-known/acme-challenge/ /var/www/letsencrypt/.well-known/acme-challenge/
#Bypass Auth
<Directory /var/www/letsencrypt/.well-known/acme-challenge/>
Satisfy any
</Directory>
#Redirect before other rewrite rules
RewriteCond %{REQUEST_URI} /\.well\-known/acme\-challenge/
RewriteRule (.*) /.well-known/acme-challenge/$1 [L,QSA]
I came across your question with the same letsencrypt acme apache alias problem. After reading through the apache documentation, I still don't undestand why the global alias doesn't work as expected (according to the documentation it should).
Anyway, here is a workaround that uses RedirectMatch (which according to the documentation is evaluated before alias). It requires one additional host and one global configuration file:
- Create an additional (sub)domain / host that only serves acme requests, lets say "acme.mydomain.tld"
Create (and enable) a global configuration that redirects all acme-requests to that host, excluding the host itself from redirection:
<If "%{HTTP_HOST} != 'acme.mydomain.tld'"> RedirectMatch "^/.well-known/(.*)$" "http://acme.mydomain.tld/.well-known/$1" </If>
This works for all my VirtualHosts which had problems with the old alias approach.