diff --git a/nginx.tmpl b/nginx.tmpl index 114c899..e09d340 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -200,7 +200,7 @@ server { listen [::]:{{ $listen_port }} {{ $default_server }}; {{ end }} access_log /var/log/nginx/access.log vhost; - return 301 https://$host:{{ $listen_port_ssl -}}$request_uri; + return 301 https://$host{{ if not (eq $listen_port_ssl "443") }}:{{ $listen_port_ssl }}{{ end }}$request_uri; } {{ end }}