Skip to content

Commit ccb6f85

Browse files
committed
compress responses
1 parent 69b6231 commit ccb6f85

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN \
3636
exit 1; \
3737
esac; \
3838
rm -rf "/tmp/*"; \
39-
apk add --update --no-cache goaccess nginx
39+
apk add --update --no-cache goaccess nginx nginx-mod-http-brotli
4040
COPY --from=build /app/www /var/www/allabiografer.se
4141
COPY etc /etc
4242
COPY init-wrapper /

etc/nginx/nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
load_module modules/ngx_http_brotli_filter_module.so;
2+
load_module modules/ngx_http_brotli_static_module.so;
3+
14
worker_processes 1;
25

36
events {
@@ -17,5 +20,19 @@ http {
1720

1821
access_log /var/log/nginx/access.log main;
1922

23+
# Brotli compression (preferred, ~15-20% better than gzip)
24+
brotli on;
25+
brotli_comp_level 6;
26+
brotli_min_length 256;
27+
brotli_types text/css;
28+
29+
# Gzip fallback for older clients
30+
gzip on;
31+
gzip_vary on;
32+
gzip_proxied any;
33+
gzip_comp_level 6;
34+
gzip_min_length 256;
35+
gzip_types text/css;
36+
2037
include /etc/nginx/sites-enabled/*;
2138
}

0 commit comments

Comments
 (0)