Skip to content

Commit aea595c

Browse files
Merge pull request #17342 from king-frog/patch-1
Automatic merge from submit-queue. update nginx-config.template
2 parents 1e29a56 + 47c1263 commit aea595c

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

images/router/nginx/conf/nginx-config.template

+28-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ http {
2121
#include /etc/nginx/fastcgi.conf;
2222
index index.html index.htm index.php;
2323

24+
ssl_certificate {{$workingDir}}/certs/default.pem;
25+
ssl_certificate_key {{$workingDir}}/certs/default.pem;
26+
2427
default_type application/octet-stream;
2528
log_format main '$remote_addr - $remote_user [$time_local] $status '
2629
'"$request" $body_bytes_sent "$http_referer" '
@@ -48,17 +51,40 @@ http {
4851
{{- if (eq $cfg.TLSTermination "") }}
4952
listen 80;
5053
{{- else }}
54+
listen 80 ssl;
5155
listen 443 ssl;
5256
{{ end -}}
57+
58+
server_name {{$cfg.Host}};
59+
{{- if and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt")) (eq $cfg.InsecureEdgeTerminationPolicy "Allow") }}
60+
{{ $cert := index $cfg.Certificates $cfg.Host -}}
61+
{{ if ne $cert.Contents "" }}
62+
ssl on;
63+
ssl_certificate {{$workingDir}}/certs/{{$cfgIdx}}.pem;
64+
ssl_certificate_key {{$workingDir}}/certs/{{$cfgIdx}}.pem;
65+
ssl_session_timeout 5m;
66+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
67+
ssl_ciphers AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM:!LOW:!EXP;
68+
ssl_prefer_server_ciphers on;
69+
{{ end -}}
5370

54-
server_name {{$cfg.Host}};
55-
{{- if and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt")) -}}
71+
{{- else if and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "edge") (eq $cfg.TLSTermination "reencrypt")) (eq $cfg.InsecureEdgeTerminationPolicy "Redirect") }}
72+
{{/*- else if (eq $cfg.InsecureEdgeTerminationPolicy "Redirect") */}}
5673
{{ $cert := index $cfg.Certificates $cfg.Host -}}
5774
{{ if ne $cert.Contents "" }}
75+
ssl on;
5876
ssl_certificate {{$workingDir}}/certs/{{$cfgIdx}}.pem;
5977
ssl_certificate_key {{$workingDir}}/certs/{{$cfgIdx}}.pem;
78+
ssl_session_timeout 5m;
79+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
80+
ssl_ciphers AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM:!LOW:!EXP;
81+
ssl_prefer_server_ciphers on;
82+
if ($scheme = http) {
83+
return 301 https://$host$request_uri;
84+
}
6085
{{ end -}}
6186
{{ end -}}
87+
6288
access_log /var/lib/nginx/logs/be_{{$cfgIdx}}.log main;
6389

6490
location / {

0 commit comments

Comments
 (0)