diff --git a/docs/README.md b/docs/README.md index 431fe60..2e0c7ad 100644 --- a/docs/README.md +++ b/docs/README.md @@ -614,6 +614,8 @@ If you are using multiple hostnames for a single container (e.g. `VIRTUAL_HOST=e { echo 'server_tokens off;'; echo 'client_max_body_size 100m;'; } > /path/to/vhost.d/www.example.com ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com ``` +#### Per-VIRTUAL_HOST http location +To add settings on a per-`VIRTUAL_HOST` basis but for the http part, add your configuration file under `/etc/nginx/vhost.d` just like the previous section except with the suffix `_http`. This allow you to add configuration before the https redirection like the acme challenge. This is mostly usefull for all others 'not supporting https redirect' `.well-known` URIs. #### Per-VIRTUAL_HOST default configuration diff --git a/nginx.tmpl b/nginx.tmpl index a0be212..76d082f 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -600,6 +600,9 @@ server { {{- if $globals.enable_ipv6 }} listen [::]:{{ $globals.external_http_port }} {{ $default_server }}; {{- end }} + {{- if (exists (printf "/etc/nginx/vhost.d/%s_http" $host)) }} + include {{ printf "/etc/nginx/vhost.d/%s_http" $host }}; + {{- end }} # Do not HTTPS redirect Let's Encrypt ACME challenge location ^~ /.well-known/acme-challenge/ {