https://github.com/tofran/nginx-with-substitutions-filter-docker
🐳 Slim Nginx Docker image with substitutions filter module (ngx_http_sub_module)
https://github.com/tofran/nginx-with-substitutions-filter-docker
alpine docker nginx nginx-docker
Last synced: 3 months ago
JSON representation
🐳 Slim Nginx Docker image with substitutions filter module (ngx_http_sub_module)
- Host: GitHub
- URL: https://github.com/tofran/nginx-with-substitutions-filter-docker
- Owner: tofran
- Created: 2021-09-02T20:58:25.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-01T01:35:38.000Z (4 months ago)
- Last Synced: 2025-03-16T16:40:10.081Z (4 months ago)
- Topics: alpine, docker, nginx, nginx-docker
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/tofran/nginx-with-substitutions-filter
- Size: 20.5 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nginx Docker image with substitutions filter module
[](https://github.com/tofran/nginx-with-substitutions-filter-docker/actions/workflows/build.yaml)
[][DockerHub]
[][DockerHub]Slim Nginx, multi-arch alpine Docker image with [substitution filter module](http://nginx.org/en/docs/http/ngx_http_sub_module.html).
The final result is a clean image completely based on the official `nginx:alpine`.
Does not contain any compile time junk, the only additions are:- Dynamic module inserted at `/usr/lib/nginx/modules/ngx_http_subs_filter_module.so`;
- Importing of the module in `/etc/nginx/nginx.conf` with `load_module`.Available on [DockerHub][DockerHub] and on [GitHub container registry][GHCR]:
```sh
docker pull tofran/nginx-with-substitutions-filter
# or
docker pull ghcr.io/tofran/nginx-with-substitutions-filter
```This repo could also be helpful as a recipe for building images with any other dynamic modules, or even as way to extract compiled binaries from them.
[DockerHub]: https://hub.docker.com/r/tofran/nginx-with-substitutions-filter
[GHCR]: https://github.com/tofran/nginx-with-substitutions-filter-docker/pkgs/container/nginx-with-substitutions-filter## Example usage
Create the following example configuration `./sample.conf`:
```nginx
server {
listen 80;location / {
subs_filter_types text/html text/css text/xml application/javascript;
subs_filter "nginx" "replaced";
root /usr/share/nginx/html;
}
}
```Now run the image:
```sh
docker run -p 8080:80 -v ./sample.conf:/etc/nginx/conf.d/default.conf tofran/nginx-with-substitutions-filter
```Visit `http://localhost:8080`:

There you go, you now have a nginx running with on-the-fly string replacement.
Happy replacing!## License
MIT