Skip to content

Commit a5d82b3

Browse files
authored
Switch to eustas/ngx_brotli (#3)
Switch to eustas/ngx_brotli according to google/ngx_brotli#69
2 parents 272f82e + 3e8a707 commit a5d82b3

File tree

5 files changed

+110
-90
lines changed

5 files changed

+110
-90
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM alpine:3.9
33
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
44

55
ENV NGINX_VERSION 1.16.0
6+
ENV BROTLI_COMMIT_HASH 8104036af9cff4b1d34f22d00ba857e2a93a243c
67

78
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
89
# Nginx Build Config
@@ -101,7 +102,10 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
101102
# Downloading Brotli
102103
&& echo "Downloading Brotli" \
103104
&& cd /usr/src \
104-
&& git clone --recursive https://github.com/google/ngx_brotli.git \
105+
&& git clone --recursive https://github.com/eustas/ngx_brotli.git \
106+
&& cd ngx_brotli \
107+
&& git checkout -b $BROTLI_COMMIT_HASH $BROTLI_COMMIT_HASH \
108+
&& cd .. \
105109
# Building Nginx
106110
&& echo "Building Nginx" \
107111
&& cd /usr/src/nginx-$NGINX_VERSION \

README.md

+26-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
# Docker Nginx
22

3-
Dockerized Nginx with TLS 1.3 and Brotli support.
3+
Dockerized Nginx based on Alpine Linux with TLS 1.3 and Brotli support.
44

5-
Based on [nginxinc/docker-nginx](https://github.com/nginxinc/docker-nginx).
5+
Inspired by:
6+
- [nginxinc/docker-nginx](https://github.com/nginxinc/docker-nginx)
7+
- [google/ngx_brotli](https://github.com/google/ngx_brotli)
8+
- [eustas/ngx_brotli](https://github.com/eustas/ngx_brotli)
9+
- [fholzer/docker-nginx-brotli](https://github.com/fholzer/docker-nginx-brotli)
610

7-
## Config
11+
## How to use this image
812

9-
To enable TLS 1.3, use:
13+
```shell
14+
docker pull hackinit/nginx-brotli
15+
docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d hackinit/nginx-brotli
16+
```
17+
18+
For extra information, please refer to the [official Docker Hub Nginx documentation](https://hub.docker.com/_/nginx/), since this image builds upon it.
19+
20+
In addition, you can look for Brotli configurations at the upstream repository [eustas/ngx_brotli](https://github.com/eustas/ngx_brotli#configuration-directives).
21+
22+
23+
## Sample config
24+
25+
To enable TLS 1.3, add:
1026

1127
```nginx
1228
ssl_protocols TLSv1.2 TLSv1.3;
1329
ssl_ciphers [TLS13+AESGCM+AES128|TLS13+AESGCM+AES256|TLS13+CHACHA20]:[EECDH+ECDSA+AESGCM+AES128|EECDH+ECDSA+CHACHA20]:EECDH+ECDSA+AESGCM+AES256:EECDH+ECDSA+AES128+SHA:EECDH+ECDSA+AES256+SHA:[EECDH+aRSA+AESGCM+AES128|EECDH+aRSA+CHACHA20]:EECDH+aRSA+AESGCM+AES256:EECDH+aRSA+AES128+SHA:EECDH+aRSA+AES256+SHA:RSA+AES128+SHA:RSA+AES256+SHA:RSA+3DES;
1430
```
15-
To enable Brotli, use this in `http` block:
31+
32+
To enable Brotli, add this in `http` block:
1633

1734
```nginx
1835
brotli on;
@@ -24,14 +41,12 @@ brotli_types *;
2441

2542
## Modification Details
2643

27-
Compiled with OpenSSL 1.1.1b, which supports TLS 1.3.
44+
Module [ngx_brotli](https://github.com/eustas/ngx_brotli) has been added for Brotli support.
2845

29-
Module [ngx_brotli](https://github.com/google/ngx_brotli) has been added for Brotli support.
30-
31-
## Build
46+
## Manually build from source
3247

3348
```bash
3449
git clone git://github.com/hackinit/docker-nginx.git
3550
cd docker-nginx
36-
docker build -t nginx:1.15.12-modified .
37-
```
51+
docker build -t nginx-brotli:latest .
52+
```

nginx.conf

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
user nginx;
2-
worker_processes 1;
3-
4-
error_log /var/log/nginx/error.log warn;
5-
pid /var/run/nginx.pid;
6-
7-
8-
events {
9-
worker_connections 1024;
10-
}
11-
12-
13-
http {
14-
include /etc/nginx/mime.types;
15-
default_type application/octet-stream;
16-
17-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18-
'$status $body_bytes_sent "$http_referer" '
19-
'"$http_user_agent" "$http_x_forwarded_for"';
20-
21-
access_log /var/log/nginx/access.log main;
22-
23-
sendfile on;
24-
#tcp_nopush on;
25-
26-
keepalive_timeout 65;
27-
28-
gzip on;
29-
30-
brotli on;
31-
brotli_static on;
32-
33-
include /etc/nginx/conf.d/*.conf;
34-
}
1+
user nginx;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
13+
http {
14+
include /etc/nginx/mime.types;
15+
default_type application/octet-stream;
16+
17+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18+
'$status $body_bytes_sent "$http_referer" '
19+
'"$http_user_agent" "$http_x_forwarded_for"';
20+
21+
access_log /var/log/nginx/access.log main;
22+
23+
sendfile on;
24+
#tcp_nopush on;
25+
26+
keepalive_timeout 65;
27+
28+
gzip on;
29+
30+
brotli on;
31+
brotli_static on;
32+
33+
include /etc/nginx/conf.d/*.conf;
34+
}

nginx.vh.default.conf

+44-44
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
server {
2-
listen 80;
3-
server_name localhost;
4-
5-
#charset koi8-r;
6-
#access_log /var/log/nginx/host.access.log main;
7-
8-
location / {
9-
root /usr/share/nginx/html;
10-
index index.html index.htm;
11-
}
12-
13-
#error_page 404 /404.html;
14-
15-
# redirect server error pages to the static page /50x.html
16-
#
17-
error_page 500 502 503 504 /50x.html;
18-
location = /50x.html {
19-
root /usr/share/nginx/html;
20-
}
21-
22-
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
23-
#
24-
#location ~ \.php$ {
25-
# proxy_pass http://127.0.0.1;
26-
#}
27-
28-
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
29-
#
30-
#location ~ \.php$ {
31-
# root html;
32-
# fastcgi_pass 127.0.0.1:9000;
33-
# fastcgi_index index.php;
34-
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
35-
# include fastcgi_params;
36-
#}
37-
38-
# deny access to .htaccess files, if Apache's document root
39-
# concurs with nginx's one
40-
#
41-
#location ~ /\.ht {
42-
# deny all;
43-
#}
44-
}
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
#charset koi8-r;
6+
#access_log /var/log/nginx/host.access.log main;
7+
8+
location / {
9+
root /usr/share/nginx/html;
10+
index index.html index.htm;
11+
}
12+
13+
#error_page 404 /404.html;
14+
15+
# redirect server error pages to the static page /50x.html
16+
#
17+
error_page 500 502 503 504 /50x.html;
18+
location = /50x.html {
19+
root /usr/share/nginx/html;
20+
}
21+
22+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
23+
#
24+
#location ~ \.php$ {
25+
# proxy_pass http://127.0.0.1;
26+
#}
27+
28+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
29+
#
30+
#location ~ \.php$ {
31+
# root html;
32+
# fastcgi_pass 127.0.0.1:9000;
33+
# fastcgi_index index.php;
34+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
35+
# include fastcgi_params;
36+
#}
37+
38+
# deny access to .htaccess files, if Apache's document root
39+
# concurs with nginx's one
40+
#
41+
#location ~ /\.ht {
42+
# deny all;
43+
#}
44+
}

0 commit comments

Comments
 (0)