add http include

This commit is contained in:
Azlux 2024-01-22 15:51:03 +01:00
parent d46881fb58
commit ad976f91ae
2 changed files with 5 additions and 0 deletions

View file

@ -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 { 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 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 #### Per-VIRTUAL_HOST default configuration

View file

@ -600,6 +600,9 @@ server {
{{- if $globals.enable_ipv6 }} {{- if $globals.enable_ipv6 }}
listen [::]:{{ $globals.external_http_port }} {{ $default_server }}; listen [::]:{{ $globals.external_http_port }} {{ $default_server }};
{{- end }} {{- 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 # Do not HTTPS redirect Let's Encrypt ACME challenge
location ^~ /.well-known/acme-challenge/ { location ^~ /.well-known/acme-challenge/ {