Skip to content

Commit 4f155f6

Browse files
authored
Merge pull request #456 from continuouspipe/feature/http2-toggle
Add HTTP2 toggling for Nginx and option for HTTP2 over HTTP
2 parents e967bc8 + ac0eac9 commit 4f155f6

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

php/nginx/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ WEB_HTTPS | Whether to support HTTPS traffic on the WEB_HTTPS_PORT | true/false
115115
WEB_HTTPS_PORT | The port to serve the HTTPS traffic from | 0-65535 | 443
116116
WEB_HTTPS_OFFLOADED | Whether the HTTPS traffic has been forwarded without SSL to the HTTPS port | true/false | false
117117
WEB_HTTPS_ONLY | Whether to redirect all HTTP traffic to HTTPS | true/false | $WEB_HTTPS (deprecated: if $WEB_HTTPS=true then false)
118+
WEB_HTTP2_TLS | Whether to enable HTTP2 over TLS on HTTPS port. If WEB_HTTPS_OFFLOADED enabled then this is ignored as TLS is not used | true/false | true
119+
WEB_HTTP2_PLAINTEXT_NONBC | Whether to enable HTTP2 over plaintext on HTTP port (or HTTPS if WEB_HTTPS_OFFLOADED enabled). Nginx doesn't support h2c for plain HTTP protocol so will not support HTTP 1.1/1.0 if enabled | true/false | false
118120
WEB_REVERSE_PROXIED | Whether to interpret X-Forwarded-Proto as the $custom_scheme and $custom_https emulation. | true/false | true
119121
WEB_SSL_CIPHERS | The enabled SSL/TLS server ciphers | the format understood by the OpenSSL library | ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
120122
WEB_SSL_FULLCHAIN | The location of the SSL certificate and intermediate chain file | absolute filename | /etc/ssl/certs/fullchain.pem

php/nginx/etc/confd/templates/nginx/site.conf.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
server {
22
server_name {{ getenv "WEB_SERVER_NAME" }};
33
{{ if ne "false" (getenv "WEB_HTTP") }}
4-
listen {{ getenv "WEB_HTTP_PORT" }} {{ if eq "true" (getenv "WEB_DEFAULT_SERVER") }} default_server{{ end }};
4+
listen {{ getenv "WEB_HTTP_PORT" }} {{ if eq "true" (getenv "WEB_DEFAULT_SERVER") }} default_server{{ end }}{{ if eq "true" (getenv "WEB_HTTP2_PLAINTEXT_NONBC") }} http2{{ end }};
55
{{ if and (eq "true" (getenv "WEB_HTTPS_ONLY")) (ne "true" (getenv "WEB_REVERSE_PROXIED")) }}
66

77
access_log off;
@@ -13,8 +13,8 @@ server {
1313
{{ end }}{{ end }}
1414
{{ if eq "true" (getenv "WEB_HTTPS") }}
1515
{{ if eq "true" (getenv "WEB_HTTPS_OFFLOADED") }}
16-
listen {{ getenv "WEB_HTTPS_PORT" }}{{ if eq "true" (getenv "WEB_DEFAULT_SERVER") }} default_server{{ end }};{{ else }}
17-
listen {{ getenv "WEB_HTTPS_PORT" }} {{ if eq "true" (getenv "WEB_DEFAULT_SERVER") }} default_server{{ end }} ssl http2;
16+
listen {{ getenv "WEB_HTTPS_PORT" }}{{ if eq "true" (getenv "WEB_DEFAULT_SERVER") }} default_server{{ end }}{{ if eq "true" (getenv "WEB_HTTP2_PLAINTEXT_NONBC") }} http2{{ end }};{{ else }}
17+
listen {{ getenv "WEB_HTTPS_PORT" }}{{ if eq "true" (getenv "WEB_DEFAULT_SERVER") }} default_server{{ end }} ssl{{ if eq "true" (getenv "WEB_HTTP2_TLS") }} http2{{ end }};
1818
ssl_certificate {{ getenv "WEB_SSL_FULLCHAIN" }};
1919
ssl_certificate_key {{ getenv "WEB_SSL_PRIVKEY" }};{{ end }}{{ end }}
2020

php/nginx/usr/local/share/env/40-webserver

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export START_NGINX
1212
START_PHP_FPM="$(convert_to_boolean_string "${START_PHP_FPM:-${START_MODE_WEB:-false}}")"
1313
export START_PHP_FPM
1414

15+
WEB_HTTP2_TLS="$(convert_to_boolean_string "${WEB_HTTP2_TLS:-true}")"
16+
export WEB_HTTP2_TLS
17+
WEB_HTTP2_PLAINTEXT_NONBC="$(convert_to_boolean_string "${WEB_HTTP2_PLAINTEXT_NONBC:-false}")"
18+
export WEB_HTTP2_PLAINTEXT_NONBC
19+
1520
export WEB_INCLUDES=${WEB_INCLUDES:-default-*}
1621
WEB_DEFAULT_SERVER="$(convert_to_boolean_string "${WEB_DEFAULT_SERVER:-true}")"
1722
export WEB_DEFAULT_SERVER

0 commit comments

Comments
 (0)