1
0

doc: add j2cfg-override example

This commit is contained in:
Konstantin Demin 2024-11-08 14:19:37 +03:00
parent e190393397
commit 086b6c4ccd
Signed by: krd
GPG Key ID: 4D56F87A8BA65FD0
8 changed files with 77 additions and 0 deletions

View File

@ -6,3 +6,4 @@
- [print env via Perl](perl/README.md)
- [SSL with subdomains](ssl/README.md)
- [generating config with templates](config-template/README.md)
- [container configuration override](j2cfg-override/README.md)

View File

@ -0,0 +1,14 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.5
SHELL [ "/bin/sh", "-ec" ]
COPY /j2cfg/ /etc/angie/j2cfg/
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/
ENV NGX_HTTP_CONFLOAD='gzip'
## same as above (adjusted to above variant by entrypoint):
## ENV NGX_HTTP_MODULES='gzip'
## enable support for brotli and zstd:
## ENV NGX_HTTP_MODULES='gzip brotli zstd'

View File

@ -0,0 +1,32 @@
# container configuration override
consult [Dockerfile](Dockerfile) or [docker-compose.yml](docker-compose.yml) - both are simple and fine enough.
---
mostly same as [simple static site](../basic/README.md) except container configuration file `j2cfg/override-compress-types.yml`.
`j2cfg/override-compress-types.yml`:
```yml
compress_types: []
---
compress_types:
- text/plain
```
this effectively disables response compression for all mime types except `text/plain`.
---
in order to enable (!) response compression specify environment variable `NGX_HTTP_CONFLOAD='gzip'` or `NGX_HTTP_MODULES='gzip brotli zstd'` (for gzip, brotli and zstd).
---
Test URI e.g. with `curl`:
```sh
curl -v --compressed http://127.0.0.1:8080/index.html
curl -v --compressed http://127.0.0.1:8080/index.txt
```

View File

@ -0,0 +1,15 @@
version: "3.8"
services:
angie-conv-example-cfg-override:
container_name: angie-conv-example-cfg-override
image: docker.io/rockdrilla/angie-conv:v0.0.5
environment:
NGX_HTTP_MODULES: 'gzip brotli zstd'
ports:
- "127.0.0.1:8080:8080"
volumes:
- "./j2cfg:/angie/j2cfg:ro"
- "./site:/angie/site:ro"
- "./static:/angie/static:ro"

View File

@ -0,0 +1,6 @@
compress_types: []
---
compress_types:
- text/plain

View File

@ -0,0 +1,3 @@
server {
listen 8080;
}

View File

@ -0,0 +1,5 @@
<hmtl>
<body>
<h1>Hello World</h1>
</body>
</hmtl>

View File

@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.