Skip to content

Commit 7f52155

Browse files
authored
Merge pull request #113 from justdan6/master
nginx to 1.25.1, other updates, and update docs and configs.
2 parents 928e38c + 69ce0f7 commit 7f52155

File tree

5 files changed

+33
-34
lines changed

5 files changed

+33
-34
lines changed

.github/workflows/dockerimage.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ jobs:
104104
105105
grep --fixed-strings '< HTTP/3 200' /tmp/h3
106106
grep --fixed-strings --invert-match -i '< server: nginx' /tmp/h3 > /dev/null
107-
grep --fixed-strings '< alt-svc: h3-27=":8889"; ma=86400, h3-28=":8889"; ma=86400, h3-29=":8889"; ma=86400' /tmp/h3
107+
grep --fixed-strings '< alt-svc: h3=":8889"; ma=86400' /tmp/h3
108108
grep --fixed-strings '< quic-status: h3' /tmp/h3
109109
grep --fixed-strings '<p>It works!</p>' /tmp/h3
110110
111111
- name: Test njs command line
112112
run: |
113-
echo "console.log('Using njs v' + njs.version)" | docker run -i --rm macbre/nginx njs -q | grep "Using njs v0.7.7"
113+
echo "console.log('Using njs v' + njs.version)" | docker run -i --rm macbre/nginx njs -q | grep "Using njs v0.7.12"
114114
115115
- name: Show logs
116116
if: always()

Dockerfile

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# https://hg.nginx.org/nginx-quic/fie/tip/src/core/nginx.h
2-
ARG NGINX_VERSION=1.23.4
1+
# https://hg.nginx.org/nginx/file/tip/src/core/nginx.h
2+
ARG NGINX_VERSION=1.25.1
33

4-
# https://hg.nginx.org/nginx-quic/shortlog/quic
5-
ARG NGINX_COMMIT=0af598651e33
4+
# https://hg.nginx.org/nginx
5+
ARG NGINX_COMMIT=5b8854a2f79c
66

77
# https://github.com/google/ngx_brotli
88
ARG NGX_BROTLI_COMMIT=6e975bcb015f62e1f303054897783355e2a877dc
99

1010
# https://github.com/google/boringssl
11-
ARG BORINGSSL_COMMIT=b0341041b03ea71d8371a9692aedae263fc06ee9
11+
ARG BORINGSSL_COMMIT=e1b8685770d0e82e5a4a3c5d24ad1602e05f2e83
1212

1313
# http://hg.nginx.org/njs
14-
ARG NJS_COMMIT=b33aae5e8dc6
14+
ARG NJS_COMMIT=a1faa64d4972
1515

1616
# https://github.com/openresty/headers-more-nginx-module#installation
1717
# we want to have https://github.com/openresty/headers-more-nginx-module/commit/e536bc595d8b490dbc9cf5999ec48fca3f488632
@@ -20,7 +20,7 @@ ARG HEADERS_MORE_VERSION=0.34
2020
# https://github.com/leev/ngx_http_geoip2_module/releases
2121
ARG GEOIP2_VERSION=3.4
2222

23-
# https://hg.nginx.org/nginx-quic/file/quic/README#l72
23+
# https://nginx.org/en/docs/http/ngx_http_v3_module.html
2424
ARG CONFIG="\
2525
--build=quic-$NGINX_COMMIT-boringssl-$BORINGSSL_COMMIT \
2626
--prefix=/etc/nginx \
@@ -74,7 +74,7 @@ ARG CONFIG="\
7474
--add-dynamic-module=/usr/src/ngx_http_geoip2_module \
7575
"
7676

77-
FROM alpine:3.16 AS base
77+
FROM alpine:3.17 AS base
7878

7979
ARG NGINX_VERSION
8080
ARG NGINX_COMMIT
@@ -117,8 +117,8 @@ RUN \
117117
WORKDIR /usr/src/
118118

119119
RUN \
120-
echo "Cloning nginx $NGINX_VERSION (rev $NGINX_COMMIT from 'quic' branch) ..." \
121-
&& hg clone -b quic --rev $NGINX_COMMIT https://hg.nginx.org/nginx-quic /usr/src/nginx-$NGINX_VERSION
120+
echo "Cloning nginx $NGINX_VERSION (rev $NGINX_COMMIT from 'default' branch) ..." \
121+
&& hg clone -b default --rev $NGINX_COMMIT https://hg.nginx.org/nginx /usr/src/nginx-$NGINX_VERSION
122122

123123
RUN \
124124
echo "Cloning brotli $NGX_BROTLI_COMMIT ..." \
@@ -199,7 +199,7 @@ RUN \
199199
| xargs -r apk info --installed \
200200
| sort -u > /tmp/runDeps.txt
201201

202-
FROM alpine:3.16
202+
FROM alpine:3.17
203203
ARG NGINX_VERSION
204204
ARG NGINX_COMMIT
205205

nginx.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ http {
1919
include /etc/nginx/mime.types;
2020
default_type application/octet-stream;
2121

22-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
22+
log_format quic '$remote_addr - $remote_user [$time_local] "$request" '
2323
'$status $body_bytes_sent "$http_referer" '
24-
'"$http_user_agent" "$http_x_forwarded_for"';
24+
'"$http_user_agent" "$http_x_forwarded_for" "$http3"';
2525

26-
access_log /var/log/nginx/access.log main;
26+
access_log /var/log/nginx/access.log quic;
2727

2828
sendfile on;
2929
#tcp_nopush on;

readme.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
## What is this?
22
[![Docker Image CI](https://github.com/macbre/docker-nginx-http3/actions/workflows/dockerimage.yml/badge.svg)](https://github.com/macbre/docker-nginx-http3/actions/workflows/dockerimage.yml)
33

4-
Stable and up-to-date [nginx](https://nginx.org/en/CHANGES) with [QUIC + **HTTP/3 experimental support**](https://hg.nginx.org/nginx-quic/shortlog/quic), [Google's `brotli` compression](https://github.com/google/ngx_brotli), [`njs` module](https://nginx.org/en/docs/njs/) and [Grade A+ SSL config](https://ssl-config.mozilla.org/)
5-
6-
nginx binary is built from [`quic` experimental branch](https://hg.nginx.org/nginx-quic/shortlog/quic). It's **not production-ready** yet!
4+
Stable and up-to-date [nginx](https://nginx.org/en/CHANGES) with [QUIC + **HTTP/3 experimental support**](https://nginx.org/en/docs/http/ngx_http_v3_module.html), [Google's `brotli` compression](https://github.com/google/ngx_brotli), [`njs` module](https://nginx.org/en/docs/njs/) and [Grade A+ SSL config](https://ssl-config.mozilla.org/)
75

86
## How to use this image
97
As this project is based on the official [nginx image](https://hub.docker.com/_/nginx/) look for instructions there. In addition to the standard configuration directives, you'll be able to use the brotli module specific ones, see [here for official documentation](https://github.com/google/ngx_brotli#configuration-directives)
@@ -28,12 +26,12 @@ docker pull ghcr.io/macbre/nginx-http3:latest
2826

2927
```
3028
$ docker run -it macbre/nginx-http3 nginx -V
31-
nginx version: nginx/1.23.4 (quic-0af598651e33-boringssl-8ce0e1c14e48109773f1e94e5f8b020aa1e24dc5)
32-
built by gcc 11.2.1 20220219 (Alpine 11.2.1_git20220219)
29+
nginx version: nginx/1.25.1 (quic-5b8854a2f79c-boringssl-e1b8685770d0e82e5a4a3c5d24ad1602e05f2e83)
30+
built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
3331
built with OpenSSL 1.1.1 (compatible; BoringSSL) (running with BoringSSL)
3432
TLS SNI support enabled
3533
configure arguments:
36-
--build=quic-0af598651e33-boringssl-8ce0e1c14e48109773f1e94e5f8b020aa1e24dc5
34+
--build=quic-5b8854a2f79c-boringssl-e1b8685770d0e82e5a4a3c5d24ad1602e05f2e83
3735
--prefix=/etc/nginx
3836
--sbin-path=/usr/sbin/nginx
3937
--modules-path=/usr/lib/nginx/modules
@@ -87,7 +85,7 @@ configure arguments:
8785
--with-ld-opt='-L../boringssl/build/ssl -L../boringssl/build/crypto'
8886
8987
$ docker run -it macbre/nginx-http3 njs -v
90-
0.7.7
88+
0.7.12
9189
```
9290

9391
## SSL Grade A+ handling
@@ -114,25 +112,26 @@ Please refer to `tests/https.conf` config file for an example config used by the
114112
```
115113
server {
116114
# http/3
117-
listen 443 http3 reuseport;
115+
listen 443 quic reuseport;
118116
119117
# http/2 and http/1.1
120-
listen 443 ssl http2;
118+
listen 443 ssl;
119+
http2 on;
121120
122121
server_name localhost; # customize to match your domain
123122
124123
# you need to mount these files when running this container
125124
ssl_certificate /etc/nginx/ssl/localhost.crt;
126125
ssl_certificate_key /etc/nginx/ssl/localhost.key;
127126
128-
# Enable all TLS versions (TLSv1.3 is required for QUIC).
129-
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
127+
# TLSv1.3 is required for QUIC.
128+
ssl_protocols TLSv1.2 TLSv1.3;
130129
131130
# 0-RTT QUIC connection resumption
132131
ssl_early_data on;
133132
134133
# Add Alt-Svc header to negotiate HTTP/3.
135-
add_header alt-svc 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400';
134+
add_header alt-svc 'h3=":443"; ma=86400';
136135
137136
# Sent when QUIC was used
138137
add_header QUIC-Status $http3;

tests/https.conf

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# https://www.nginx.com/blog/introducing-technology-preview-nginx-support-for-quic-http-3/
22
server {
33
# quic and http/3
4-
listen 443 http3 reuseport;
4+
listen 443 quic reuseport;
55

66
# http/2 and http/1.1
7-
listen 443 ssl http2;
8-
7+
listen 443 ssl;
8+
http2 on;
99
server_name localhost;
1010

1111
# openssl-generated pair for local development
1212
# https://letsencrypt.org/docs/certificates-for-localhost/
1313
ssl_certificate /etc/nginx/ssl/localhost.crt;
1414
ssl_certificate_key /etc/nginx/ssl/localhost.key;
1515

16-
# Enable all TLS versions (TLSv1.3 is required for QUIC).
17-
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
16+
# TLSv1.3 is required for QUIC.
17+
ssl_protocols TLSv1.2 TLSv1.3;
1818

1919
# 0-RTT QUIC connection resumption
2020
ssl_early_data on;
2121

2222
# Add Alt-Svc header to negotiate HTTP/3.
23-
add_header alt-svc 'h3-27=":8889"; ma=86400, h3-28=":8889"; ma=86400, h3-29=":8889"; ma=86400';
23+
add_header alt-svc 'h3=":8889"; ma=86400';
2424
add_header QUIC-Status $http3; # Sent when QUIC was used
2525

2626
location / {

0 commit comments

Comments
 (0)