Skip to content

Drop-in replacement for the official nginx image with many useful modules.

License

Notifications You must be signed in to change notification settings

zengxs/docker-nginx

Repository files navigation

NGINX docker image with many useful modules

build dockerhub pulls dockerhub size dockerhub version license arch

Drop-in replacement for the official nginx image with many useful modules.

You can use it just like the official image without any changes, but you can enjoy many useful modules that are not included in the official image by adding some simple load_module directives in your NGINX configuration.

NOTE: This image is based on the official image debian variant, and all default configurations are the same as the official image. So you must explicitly enable the modules you want to use, otherwise this image will not be different from the official image.

How to use this image?

Just replace the official image name with this image name from your docker-compose file or other docker commands.

Change your docker-compose file like this:

 version: '3.9'
 services:
   nginx:
-    image: nginx:1.27.2
+    image: zengxs/nginx:1.27.2

Or change your docker command like this:

 docker run -d \
   --name nginx \
   --restart=always \
   -v $PWD/conf.d:/etc/nginx/conf.d \
   -v $PWD/certs:/etc/nginx/certs \
   -p 80:80 -p 443:443 \
-  nginx:1.27.2
+  zengxs/nginx:1.27.2

Third-party modules

Dynamic modules

Module Description Dynamic module file name
ngx_brotli Brotli compression module maintained by Google ngx_http_brotli_filter_module.so
ngx_http_brotli_static_module.so
headers-more-nginx-module More set of headers for NGINX ngx_http_headers_more_filter_module.so
nginx-module-vts Nginx virtual host traffic status module ngx_http_vhost_traffic_status_module.so
ngx_http_geoip2_module GeoIP2 module for NGINX (GeoLite2 database included1) ngx_http_geoip2_module.so
ngx_stream_geoip2_module.so
ngx-fancyindex Fancy indexes module for NGINX ngx_http_fancyindex_module.so
ngx_http_substitutions_filter_module Substitutions filter module for NGINX ngx_http_subs_filter_module.so

All dynamic modules are installed in /usr/lib/nginx/modules directory. You can use the following command to list them:

docker run --rm -it zengxs/nginx ls -lh /usr/lib/nginx/modules/

You can enable them by simply adding some load_module directives in your NGINX configuration:

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

njs modules

Module Description JS module file name
njs-acme ACME module for NGINX acme.js

All njs modules are installed in /usr/share/nginx/njs_modules directory. You can use the following command to list them:

docker run --rm -it zengxs/nginx ls -lh /usr/share/nginx/njs_modules/

You must enable the njs module to use njs modules:

# load dynamic modules
load_module modules/ngx_http_js_module.so;
load_module modules/ngx_stream_js_module.so;

# set search path for njs
js_path /usr/share/nginx/njs_modules;

Then you can import njs modules in your NGINX configuration:

js_import acme from 'acme.js';

License

All submodules are licensed under their own licenses. Other files are licensed under the MIT License unless otherwise specified.

Footnotes

  1. GeoLite2 database is located at /usr/share/GeoIP/GeoLite2-{ASN,City,Country}.mmdb.

About

Drop-in replacement for the official nginx image with many useful modules.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published