Don't need to use a regexp because the vhost.d/default configuration must be include
specificaly in each server configurations by the nginx.tmpl template file.
Something like:
{{ if (exists (printf "/etc/nginx/vhost.d/%s" $host)) }}
include {{ printf "/etc/nginx/vhost.d/%s" $host }};
{{ else if (exists "/etc/nginx/vhost.d/default") }}
include /etc/nginx/vhost.d/default;
{{ end }}
In nginx.tmpl, vhosts.d are included before the 'location /' target, and last basic location wins.
If our /.well-known location is defined as a prefix string (or as a regex), it takes priority over basic locations
Details on http://nginx.org/en/docs/http/ngx_http_core_module.html#location
SAN certificates are now only created if the domain is contained in the base_domain.
For example:
LETSENCRYPT_HOST=domain.tld,sub.domain.tld,sub2.domain.tld,newdomain.tld,sub.newdomain.tld
will create 2 SAN certificates for domain.tld and newdomain.tld.
Assuming they're following a conventional setup, this will warn users
that they likely didn't set their volumes up correctly. It's not an
error though because they may have done something like mount the entire
/etc/nginx directory.
I hadn't seen this pattern before and it took me a while to figure out
where the loop was happening. (It could have been in the docker
invocation, in entrypoint.sh, or in start.sh too.)
Add a break into the letsencrypt block so that no more rules are executed otherwise if you have a block like...
## Start of configuration add by letsencrypt container
location /.well-known/acme-challenge/ {
auth_basic off;
root /usr/share/nginx/html;
try_files $uri =404;
}
## End of configuration add by letsencrypt container
if (!-f /code/home/cookies/$cookie_AUTH_COOKIE) {
rewrite ^ https://auth.example.org break;
}
Then lets encrypt never manages to verify the domain as the request gets re-written to the authentication URL.
docker inspect command return a leading :ro or :rw string when use with
docker-compose. This fix remove the leading string to get only the
container ID. Thanks anoopr.
Fix #1 and close #2.