|
21 | 21 | #include /etc/nginx/fastcgi.conf;
|
22 | 22 | index index.html index.htm index.php;
|
23 | 23 |
|
| 24 | + ssl_certificate {{$workingDir}}/certs/default.pem; |
| 25 | + ssl_certificate_key {{$workingDir}}/certs/default.pem; |
| 26 | + |
24 | 27 | default_type application/octet-stream;
|
25 | 28 | log_format main '$remote_addr - $remote_user [$time_local] $status '
|
26 | 29 | '"$request" $body_bytes_sent "$http_referer" '
|
@@ -48,17 +51,40 @@ http {
|
48 | 51 | {{- if (eq $cfg.TLSTermination "") }}
|
49 | 52 | listen 80;
|
50 | 53 | {{- else }}
|
| 54 | + listen 80 ssl; |
51 | 55 | listen 443 ssl;
|
52 | 56 | {{ 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 -}} |
53 | 70 |
|
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") */}} |
56 | 73 | {{ $cert := index $cfg.Certificates $cfg.Host -}}
|
57 | 74 | {{ if ne $cert.Contents "" }}
|
| 75 | + ssl on; |
58 | 76 | ssl_certificate {{$workingDir}}/certs/{{$cfgIdx}}.pem;
|
59 | 77 | 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 | + } |
60 | 85 | {{ end -}}
|
61 | 86 | {{ end -}}
|
| 87 | + |
62 | 88 | access_log /var/lib/nginx/logs/be_{{$cfgIdx}}.log main;
|
63 | 89 |
|
64 | 90 | location / {
|
|
0 commit comments