diff --git a/doc/examples/README.md b/doc/examples/README.md index b4497fe..3223727 100644 --- a/doc/examples/README.md +++ b/doc/examples/README.md @@ -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) diff --git a/doc/examples/j2cfg-override/Dockerfile b/doc/examples/j2cfg-override/Dockerfile new file mode 100644 index 0000000..9397815 --- /dev/null +++ b/doc/examples/j2cfg-override/Dockerfile @@ -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' diff --git a/doc/examples/j2cfg-override/README.md b/doc/examples/j2cfg-override/README.md new file mode 100644 index 0000000..1cf4ce9 --- /dev/null +++ b/doc/examples/j2cfg-override/README.md @@ -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 +``` diff --git a/doc/examples/j2cfg-override/docker-compose.yml b/doc/examples/j2cfg-override/docker-compose.yml new file mode 100644 index 0000000..0b348a8 --- /dev/null +++ b/doc/examples/j2cfg-override/docker-compose.yml @@ -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" diff --git a/doc/examples/j2cfg-override/j2cfg/override-compress-types.yml b/doc/examples/j2cfg-override/j2cfg/override-compress-types.yml new file mode 100644 index 0000000..1ca263d --- /dev/null +++ b/doc/examples/j2cfg-override/j2cfg/override-compress-types.yml @@ -0,0 +1,6 @@ +compress_types: [] + +--- + +compress_types: +- text/plain diff --git a/doc/examples/j2cfg-override/site/http-site.conf b/doc/examples/j2cfg-override/site/http-site.conf new file mode 100644 index 0000000..8ff8ce6 --- /dev/null +++ b/doc/examples/j2cfg-override/site/http-site.conf @@ -0,0 +1,3 @@ +server { + listen 8080; +} \ No newline at end of file diff --git a/doc/examples/j2cfg-override/static/index.html b/doc/examples/j2cfg-override/static/index.html new file mode 100644 index 0000000..09a2238 --- /dev/null +++ b/doc/examples/j2cfg-override/static/index.html @@ -0,0 +1,5 @@ + + +

Hello World

+ +
\ No newline at end of file diff --git a/doc/examples/j2cfg-override/static/index.txt b/doc/examples/j2cfg-override/static/index.txt new file mode 100644 index 0000000..08e00ed --- /dev/null +++ b/doc/examples/j2cfg-override/static/index.txt @@ -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. \ No newline at end of file