Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gzip compression #24

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ This is a high-performance version of NGINX, which has been enhanced by Alwatr f

## Usage

The recommended method for using the Alwatr Nginx is to place it behind a Kubernetes ingress or a simple edge reverse-proxy like Traefik. In this setup, there's no need to configure edge features such as gzip compression, SSL, etc., or even set up a domain or multiple websites.
The recommended method for using the Alwatr Nginx is to place it behind a Kubernetes ingress or a simple edge reverse-proxy like Traefik.
In this setup, there's no need to configure edge features such as SSL, Domain, etc. in the Alwatr Nginx.

```Dockerfile
FROM ghcr.io/alwatr/nginx:2
Expand Down
4 changes: 4 additions & 0 deletions nginx-cdn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ENV NGINX_CLIENT_MAX_BODY_SIZE=1k \
NGINX_EXPIRES_DEFAULT=max \
NGINX_LIMIT_REQ_RATE=200 \
NGINX_LIMIT_REQ_BURST=1000 \
NGINX_GZIP=on \
NGINX_GZIP_VARY=on \
NGINX_GZIP_COMP_LEVEL=5 \
NGINX_GZIP_MIN_LENGTH=256 \
NGINX_DISABLE_SYMLINKS=if_not_owner

ARG BUILD_REV
Expand Down
4 changes: 4 additions & 0 deletions nginx-core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ ENV NGINX_CLIENT_MAX_BODY_SIZE=10m \
NGINX_EXPIRES_DEFAULT=epoch \
NGINX_LIMIT_REQ_RATE=200 \
NGINX_LIMIT_REQ_BURST=1000 \
NGINX_GZIP=on \
NGINX_GZIP_VARY=on \
NGINX_GZIP_COMP_LEVEL=5 \
NGINX_GZIP_MIN_LENGTH=256 \
NGINX_DISABLE_SYMLINKS=if_not_owner

ARG BUILD_REV
Expand Down
35 changes: 35 additions & 0 deletions nginx-core/etc/nginx/templates/http.d/61-gzip.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
gzip $NGINX_GZIP;
gzip_comp_level $NGINX_GZIP_COMP_LEVEL;
gzip_vary $NGINX_GZIP_VARY;
gzip_min_length $NGINX_GZIP_MIN_LENGTH;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_buffers 32 4k;
gzip_proxied any;
gzip_types
application/ecmascript
application/javascript
application/json
application/postscript
application/font-woff
application/x-javascript
application/vnd.ms-fontobject
application/x-font-opentype
application/x-font-truetype
application/x-font-ttf
application/xml
image/gif
image/svg+xml
image/x-icon
text/x-component
text/x-js
text/css
text/csv
text/javascript
text/plain
text/xml
text/xsd
text/xsl
font/eot
font/opentype
font/otf
font/woff
52 changes: 52 additions & 0 deletions nginx-core/etc/nginx/templates/http.d/62-brotli.conf.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
brotli on;
brotli_static on;
brotli_comp_level 6;
brotli_min_length 1000;
brotli_buffers 32 8k;
brotli_types
application/ecmascript
application/javascript
application/json
application/pdf
application/postscript
application/font-woff
application/font-woff2
application/x-javascript
application/vnd.ms-fontobject
application/x-font-opentype
application/x-font-truetype
application/x-font-ttf
application/xml
image/gif
image/jpeg
image/png
image/svg+xml
image/tiff
image/vnd.microsoft.icon
image/x-icon
image/webp
text/x-component
text/x-js
text/css
text/csv
text/javascript
text/plain
text/xml
text/xsd
text/xsl
font/eot
font/opentype
font/otf
font/woff
font/woff2
video/3gpp
video/mp4
video/mpeg
video/ogg
video/quicktime
video/webm
video/x-flv
video/x-mng
video/x-ms-asf
video/x-ms-wmv
video/x-msvideo;
4 changes: 4 additions & 0 deletions nginx-json/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ENV NGINX_CLIENT_MAX_BODY_SIZE=1k \
NGINX_EXPIRES_DEFAULT=epoch \
NGINX_LIMIT_REQ_RATE=400 \
NGINX_LIMIT_REQ_BURST=1000 \
NGINX_GZIP=on \
NGINX_GZIP_VARY=on \
NGINX_GZIP_COMP_LEVEL=5 \
NGINX_GZIP_MIN_LENGTH=256 \
NGINX_DISABLE_SYMLINKS=if_not_owner

ARG BUILD_REV
Expand Down
4 changes: 4 additions & 0 deletions nginx-pwa/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ENV NGINX_CLIENT_MAX_BODY_SIZE=1k \
NGINX_EXPIRES_DEFAULT=epoch \
NGINX_LIMIT_REQ_RATE=400 \
NGINX_LIMIT_REQ_BURST=1000 \
NGINX_GZIP=on \
NGINX_GZIP_VARY=on \
NGINX_GZIP_COMP_LEVEL=5 \
NGINX_GZIP_MIN_LENGTH=256 \
NGINX_DISABLE_SYMLINKS=if_not_owner \
NGINX_CONFIG_JS_PATH=/data/config.js

Expand Down
4 changes: 4 additions & 0 deletions nginx-ws/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ENV NGINX_CLIENT_MAX_BODY_SIZE=1k \
NGINX_EXPIRES_DEFAULT=epoch \
NGINX_LIMIT_REQ_RATE=400 \
NGINX_LIMIT_REQ_BURST=1000 \
NGINX_GZIP=on \
NGINX_GZIP_VARY=on \
NGINX_GZIP_COMP_LEVEL=5 \
NGINX_GZIP_MIN_LENGTH=256 \
NGINX_DISABLE_SYMLINKS=if_not_owner

ARG BUILD_REV
Expand Down
Loading