Merge http & https server blocks
This commit is contained in:
parent
b4b5d63fe8
commit
5108e8e313
1 changed files with 7 additions and 12 deletions
21
nginx.tmpl
21
nginx.tmpl
|
@ -445,22 +445,17 @@ server {
|
||||||
|
|
||||||
{{ if $is_https }}
|
{{ if $is_https }}
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name {{ $host_alias }};
|
||||||
{{ if eq $https_method "redirect" }}
|
{{ if eq $https_method "redirect" }}
|
||||||
server {
|
listen {{ $external_http_port }} {{ $default_server }};
|
||||||
server_name {{ $host_alias }};
|
|
||||||
listen 80 {{ $default_server }};
|
|
||||||
{{ if $enable_ipv6 }}
|
|
||||||
listen [::]:80 {{ $default_server }};
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
access_log /var/log/nginx/access.log vhost;
|
listen {{ $external_https_port }} ssl http2 {{ $default_server }};
|
||||||
return 301 https://{{ $first_host }}$request_uri;
|
|
||||||
}
|
|
||||||
{{ end }}
|
|
||||||
server {
|
|
||||||
server_name {{ $host_alias }};
|
|
||||||
listen 443 ssl http2 {{ $default_server }};
|
|
||||||
{{ if $enable_ipv6 }}
|
{{ if $enable_ipv6 }}
|
||||||
listen [::]:443 ssl http2 {{ $default_server }};
|
{{ if eq $https_method "redirect" }}
|
||||||
|
listen [::]:{{ $external_http_port }} {{ $default_server }};
|
||||||
|
{{ end }}
|
||||||
|
listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }};
|
||||||
{{ end }}
|
{{ end }}
|
||||||
access_log /var/log/nginx/access.log vhost;
|
access_log /var/log/nginx/access.log vhost;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue