Package generation refactoring, stage 2.

Imported 3rd-party open-source modules which are being distributed
for NGINX Plus.
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..b794689
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,4 @@
+syntax:glob
+.git/
+subinclude:contrib/.hgignore
+subinclude:contrib/tarballs/.hgignore
diff --git a/alpine/APKBUILD-base.in b/alpine/APKBUILD-base.in
index e75e74a..9dc1068 100644
--- a/alpine/APKBUILD-base.in
+++ b/alpine/APKBUILD-base.in
@@ -9,7 +9,7 @@
 pkgver=$_base_version
 pkgrel=$_base_release
 pkgdesc="High performance web server"
-url="http://nginx.org/"
+url="https://nginx.org/"
 arch="all"
 license="2-clause BSD-like license"
 provides="nginx-r$_base_version"
@@ -22,8 +22,7 @@
 pkggroups=""
 install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-deinstall $pkgname.post-upgrade"
 
-# we would like to ship all docs/licenses in the base package
-#subpackages="$pkgname-doc"
+subpackages="$pkgname-dbg"
 
 replaces="nginx-common nginx-initscripts nginx-lua nginx-rtmp"
 source="nginx-$_base_version.tar.gz
diff --git a/alpine/APKBUILD-module.in b/alpine/APKBUILD-module.in
index e986377..119a1c8 100644
--- a/alpine/APKBUILD-module.in
+++ b/alpine/APKBUILD-module.in
@@ -9,7 +9,7 @@
 pkgver=%%MODULE_VERSION_PREFIX%%%%MODULE_VERSION%%
 pkgrel=%%MODULE_RELEASE%%
 pkgdesc="%%SUMMARY%%"
-url="http://nginx.org/"
+url="https://nginx.org/"
 arch="all"
 license="2-clause BSD-like license"
 depends="nginx-r$_base_version %%MODULE_DEPENDS%%"
@@ -23,8 +23,7 @@
 pkggroups=""
 install="$pkgname.post-install"
 
-# we would like to ship all docs/licenses in the base package
-#subpackages="$pkgname-doc"
+subpackages="$pkgname-dbg"
 
 source="nginx-module-%%MODULE%%-$_base_version.tar.gz
 	%%MODULE_SOURCES%%
@@ -34,12 +33,75 @@
 
 _modules_dir="usr/lib/nginx/modules"
 
+unpack() {
+	local u
+	verify || return 1
+	initdcheck || return 1
+	mkdir -p "$srcdir"
+	local gunzip=$(command -v pigz || echo gunzip)
+	[ $gunzip = "/usr/bin/pigz" ] && gunzip="$gunzip -d"
+	for u in $source; do
+		local s
+		local done=1
+		if is_remote "$u"; then
+			s="$SRCDEST/$(filename_from_uri $u)"
+		else
+			s="$startdir/$u"
+		fi
+		case "$s" in
+			*.tar)
+				done=0
+				msg "Unpacking $s..."
+				tar -C "$srcdir" -xf "$s" || return 1;;
+			*.tar.gz|*.tgz)
+				done=0
+				msg "Unpacking $s..."
+				$gunzip -c "$s" | tar -C "$srcdir" -x || return 1;;
+			*.tar.bz2)
+				done=0
+				msg "Unpacking $s..."
+				tar -C "$srcdir" -jxf "$s" || return 1;;
+			*.tar.lz)
+				done=0
+				msg "Unpacking $s..."
+				tar -C "$srcdir" --lzip -xf "$s" || return 1;;
+			*.tar.lzma)
+				done=0
+				msg "Unpacking $s..."
+				unlzma -T 0 -c "$s" | tar -C "$srcdir" -x  \
+					|| return 1;;
+			*.tar.xz)
+				done=0
+				msg "Unpacking $s..."
+				local threads_opt
+				if [ $(readlink -f $(command -v unxz)) != "/bin/busybox" ]; then
+					threads_opt="--threads=0"
+				fi
+				unxz $threads_opt -c "$s" | tar -C "$srcdir" -x || return 1;;
+			*.zip)
+				done=0
+				msg "Unpacking $s..."
+				unzip -n -q "$s" -d "$srcdir" || return 1;;
+		esac
+		if [ $done -eq 0 ]; then
+			bs=`basename $s`
+			sn=`echo $bs | sed -e 's/-[0-9].*$//'`
+			if [ "$sn" = "$bs" ] ; then
+				sn=${bs%-*}
+			fi
+			( cd "$srcdir" && \
+				sndir=`find * -type d -maxdepth 1 -name "${sn}-*" | head -1` ; \
+				test -n "$sndir" && ln -s ${sndir} ${sn} ||: )
+		fi
+	done
+}
+
 prepare() {
 	local file; for file in $source; do
 		case $file in
 		*~*.patch)
 			msg $file
-			cd "$srcdir"/${file%%~*}-*
+			cd "$srcdir"/${file%%~*}
 			patch -p 1 -i "$srcdir/$file"
 			;;
 		*.patch)
@@ -68,13 +130,13 @@
 
 	cd "$builddir"
 
-	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_MODULE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT_DEBUG%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT_DEBUG%%" --with-debug
+	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT_DEBUG%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT_DEBUG%%" --with-debug
 	make $_make_opts modules
 	for so in `find objs/ -maxdepth 1 -type f -name "*.so"`; do \
 		debugso=`echo ${so} | sed -e "s|.so|-debug.so|"` ; \
 		mv ${so} ${debugso} ; \
         done
-	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_MODULE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT%%"
+	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT%%"
 	make $_make_opts modules
 }
 
diff --git a/alpine/APKBUILD-plus-module.in b/alpine/APKBUILD-plus-module.in
index e62b9db..3bbcf63 100644
--- a/alpine/APKBUILD-plus-module.in
+++ b/alpine/APKBUILD-plus-module.in
@@ -69,13 +69,13 @@
 
 	cd "$builddir"
 
-	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_MODULE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT_DEBUG%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT_DEBUG%%" --with-debug
+	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT_DEBUG%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT_DEBUG%%" --with-debug
 	make $_make_opts modules
 	for so in `find objs/ -maxdepth 1 -type f -name "*.so"`; do \
 		debugso=`echo ${so} | sed -e "s|.so|-debug.so|"` ; \
 		mv ${so} ${debugso} ; \
         done
-	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_MODULE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT%%"
+	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT%%" --with-ld-opt="$LDFLAGS %%MODULE_LD_OPT%%"
 	make $_make_opts modules
 }
 
diff --git a/alpine/Makefile b/alpine/Makefile
index 0e75654..66debe9 100644
--- a/alpine/Makefile
+++ b/alpine/Makefile
@@ -10,6 +10,8 @@
 DOCS?=		../docs
 SRCPATH?=	../..
 MODSRC_PREFIX=	../
+CONTRIB?=	../contrib
+CONTRIB:=	$(abspath $(CONTRIB))
 
 MODULE_TARGET?= oss
 
@@ -33,6 +35,8 @@
 default:
 	@echo "valid targets: all base $(addprefix module-, $(MODULES)) test test-debug"
 
+BASE_MODULES=	geoip image-filter njs perl xslt
+
 MODULES=
 
 -include Makefile.module-*
@@ -79,12 +83,9 @@
 	--with-stream_ssl_module \
 	--with-stream_ssl_preread_module
 
-BASE_MODULE_CONFIGURE_ARGS=\
-	--with-compat
-
 export CR=\\n
 
-modname = $(shell echo $1 | cut -d '-' -f 3- | tr '-' '_')
+modname = $(shell echo $1 | tr '-' '_')
 
 ${HOME}/.abuild:
 	mkdir -p ${HOME}/.abuild
@@ -96,9 +97,23 @@
 ${HOME}/.abuild/abuild.conf: ${HOME}/.abuild/abuild-key.rsa | ${HOME}/.abuild
 	echo PACKAGER_PRIVKEY=\"${HOME}/.abuild/abuild-key.rsa\" > ${HOME}/.abuild/abuild.conf
 
-all:	base modules
+list-base:
+	@printf "%-20s\t%s\n" nginx $(BASE_VERSION)-$(BASE_RELEASE)
+
+list-module-%:
+	@printf "%-20s\t%s\n" $* $(MODULE_VERSION_$(call modname, $*))-$(MODULE_RELEASE_$(call modname, $*))
+
+list-all-modules: $(addprefix list-module-, $(MODULES))
+
+list-base-modules: $(addprefix list-module-, $(BASE_MODULES))
+
+list: list-base list-all-modules
+
+all:	base base-modules
 	@echo "===> all done"
 
+base-modules:	base $(addprefix module-, $(BASE_MODULES))
+
 modules:	base $(addprefix module-, $(MODULES))
 
 abuild:	abuild-base $(addprefix abuild-module-, $(MODULES))
@@ -110,7 +125,8 @@
 	touch base
 
 $(BASE_SRC):
-	wget http://nginx.org/download/$(BASE_SRC)
+	cd $(CONTRIB) && make .sum-nginx
+	ln -s $(CONTRIB)/tarballs/$(BASE_SRC) $(BASE_SRC)
 
 abuild-base: $(BASE_SRC)
 	@echo "===> Creating $@"
@@ -135,7 +151,7 @@
 	ln -s abuild-$@/pkg/$(MODULE_PACKAGE_PREFIX)-$*/usr/lib/nginx/modules $@ && \
 	touch $@
 
-abuild-module-%: $(BASE_SRC)
+abuild-module-%: $(BASE_SRC) .deps-module-%
 	@echo "===> Creating $@"
 	@{ \
 	set -e ; \
@@ -145,13 +161,16 @@
 	mkdir -p $${builddir} ; \
 	cp $(BASE_SRC) $${builddir}/nginx-module-$${module_asis}-$(BASE_VERSION).tar.gz ; \
 	sources= ; \
-	for src in $(MODULE_SOURCES_$(call modname, $@)); do \
-		cp src/$${src} $${builddir}/ ; \
+	for src in $(MODULE_SOURCES_$(call modname, $*)); do \
+		cp $(CONTRIB)/tarballs/$${src} $${builddir}/ ; \
 		sources="$${sources} $${src}" ; \
 	done ; \
-	for p in $(MODULE_PATCHES_$(call modname, $@)); do \
-		cp src/$${p} $${builddir}/ ; \
-		sources="$${sources} $${p}" ; \
+	for p in $(MODULE_PATCHES_$(call modname, $*)); do \
+		dn=`dirname $${p}` ; \
+		bdn=`basename $${dn}` ; \
+		pn="$${bdn}~`basename $${p}`" ; \
+		cp $${p} $${builddir}/$${pn} ; \
+		sources="$${sources} $${pn}" ; \
 	done ; \
 	module_copyright="nginx-module-$${module_asis}.copyright" ; \
 	cp -p $(DOCS)/$${module_copyright} $${builddir}/COPYRIGHT ; \
@@ -160,34 +179,34 @@
 	else \
 		postinstall_script=$${builddir}/nginx-plus-module-$${module_asis}.post-install ; \
 	fi ; \
-	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	addcontroltags=`echo "$$MODULE_ADD_CONTROL_TAGS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	buildenv=`echo "$$MODULE_ENV_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	post=`echo "$$MODULE_POST_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	addcontroltags=`echo "$$MODULE_ADD_CONTROL_TAGS_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	buildenv=`echo "$$MODULE_ENV_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	post=`echo "$$MODULE_POST_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
 	cat $(APKBUILD_TEMPLATE) | sed \
 		-e "s#%%MODULE%%#$${module_asis}#g" \
-		-e "s#%%SUMMARY%%#nginx $(MODULE_SUMMARY_$(call modname, $@))#g" \
-		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $@))#g" \
+		-e "s#%%SUMMARY%%#nginx $(MODULE_SUMMARY_$(call modname, $*))#g" \
+		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $*))#g" \
 		-e "s#%%BASE_VERSION%%#$(BASE_VERSION)#g" \
 		-e "s#%%BASE_RELEASE%%#$(BASE_RELEASE)#g" \
+		-e 's#%%BASE_CONFIGURE_ARGS%%#$(BASE_CONFIGURE_ARGS)#g' \
 		-e "s#%%PLUS_VERSION%%#$(PLUS_VERSION)#g" \
-		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $@))#g" \
-		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $@))#g" \
-		-e "s#%%MODULE_VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $@))#g" \
-		-e 's#%%BASE_MODULE_CONFIGURE_ARGS%%#$(BASE_MODULE_CONFIGURE_ARGS)#g' \
-		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $@))#g" \
+		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $*))#g" \
+		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $*))#g" \
+		-e "s#%%MODULE_VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $*))#g" \
+		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $*))#g" \
 		-e "s#%%MODULE_SOURCES%%#$${sources}#g" \
-		-e "s#%%MODULE_BUILD_DEPENDS%%#$(MODULE_BUILD_DEPENDS_$(call modname, $@))#g" \
-		-e "s#%%MODULE_DEPENDS%%#$(MODULE_DEPENDS_$(call modname, $@))#g" \
-		-e "s#%%MODULE_PROVIDES%%#$(MODULE_PROVIDES_$(call modname, $@))#g" \
+		-e "s#%%MODULE_BUILD_DEPENDS%%#$(MODULE_BUILD_DEPENDS_$(call modname, $*))#g" \
+		-e "s#%%MODULE_DEPENDS%%#$(MODULE_DEPENDS_$(call modname, $*))#g" \
+		-e "s#%%MODULE_PROVIDES%%#$(MODULE_PROVIDES_$(call modname, $*))#g" \
 		-e "s#%%MODULE_PREBUILD%%#$${prebuild}#g" \
 		-e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \
-		-e "s#%%MODULE_CC_OPT%%#$(MODULE_CC_OPT_$(call modname, $@))#g" \
-		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $@))#g" \
-		-e "s#%%MODULE_LD_OPT%%#$(MODULE_LD_OPT_$(call modname, $@))#g" \
-		-e "s#%%MODULE_LD_OPT_DEBUG%%#$(MODULE_LD_OPT_DEBUG_$(call modname, $@))#g" \
+		-e "s#%%MODULE_CC_OPT%%#$(MODULE_CC_OPT_$(call modname, $*))#g" \
+		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $*))#g" \
+		-e "s#%%MODULE_LD_OPT%%#$(MODULE_LD_OPT_$(call modname, $*))#g" \
+		-e "s#%%MODULE_LD_OPT_DEBUG%%#$(MODULE_LD_OPT_DEBUG_$(call modname, $*))#g" \
 		-e "s#%%ADD_CONTROL_TAGS%%#$${addcontroltags}#g" \
 		-e "s#%%MODULE_ENV%%#$${buildenv}#g" \
 		-e "s#%%MODULE_SRCDIR%%#$(MODULE_SRCDIR)#g" \
@@ -197,6 +216,9 @@
 	> $${postinstall_script} ; \
 	}
 
+.deps-module-%:
+	touch $@
+
 nginx-tests:
 	@{ \
 	if [ -d "$(SRCPATH)/nginx-tests" ]; then \
@@ -204,7 +226,7 @@
 		cp -rP $(SRCPATH)/nginx-tests nginx-tests ; \
 	else \
 		echo "===> Cloning tests" ; \
-		hg clone http://hg.nginx.org/nginx-tests ; \
+		hg clone https://hg.nginx.org/nginx-tests ; \
 	fi ; \
 	}
 
@@ -213,6 +235,8 @@
 	@{ \
 	pwd=`pwd` ; \
 	globals= ; \
+	globals_http= ; \
+	globals_stream= ; \
 	for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \
 		globals="$$globals load_module $$pwd/$$so;" ; \
 	done ; \
@@ -220,12 +244,16 @@
 		globals="$$globals env PERL5LIB=$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl:$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl/blib/arch;" ; \
 	fi ; \
 	if [ -d $$pwd/abuild-module-modsecurity ]; then \
-		export LD_LIBRARY_PATH=$$pwd/abuild-module-modsecurity/src/modsecurity-v$(LIBMODSECURITY_VERSION)/local/lib ; \
+		export LD_LIBRARY_PATH=$$pwd/abuild-module-modsecurity/src/modsecurity-v$(MODSECURITY_VERSION)/local/lib ; \
 	fi ; \
 	if [ -d $$pwd/abuild-module-opentracing ]; then \
 		export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$pwd/abuild-module-opentracing/src/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib ; \
 	fi ; \
-	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
+	if [ -d $$pwd/abuild-module-lua ]; then \
+		globals_http="lua_package_path '$$pwd/abuild-module-lua/src/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/abuild-module-lua/src/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \
+		globals_stream="$$globals_http" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \
 	}
 
 test-debug: base nginx-tests
@@ -233,6 +261,8 @@
 	@{ \
 	pwd=`pwd` ; \
 	globals= ; \
+	globals_http= ; \
+	globals_stream= ; \
 	for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \
 		globals="$$globals load_module $$pwd/$$so;" ; \
 	done ; \
@@ -240,16 +270,45 @@
 		globals="$$globals env PERL5LIB=$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl:$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl/blib/arch;" ; \
 	fi ; \
 	if [ -d $$pwd/abuild-module-modsecurity ]; then \
-		export LD_LIBRARY_PATH=$$pwd/abuild-module-modsecurity/src/modsecurity-v$(LIBMODSECURITY_VERSION)/local/lib ; \
+		export LD_LIBRARY_PATH=$$pwd/abuild-module-modsecurity/src/modsecurity-v$(MODSECURITY_VERSION)/local/lib ; \
 	fi ; \
 	if [ -d $$pwd/abuild-module-opentracing ]; then \
 		export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$pwd/abuild-module-opentracing/src/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib ; \
 	fi ; \
-	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
+	if [ -d $$pwd/abuild-module-lua ]; then \
+		globals_http="lua_package_path '$$pwd/abuild-module-lua/src/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/abuild-module-lua/src/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \
+		globals_stream="$$globals_http" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \
+	}
+
+test-modules: $(addprefix test-module-, $(MODULES))
+
+test-module-%: base nginx-tests module-%
+	@{ \
+	module=`echo $@ | cut -d '-' -f 3-` ; \
+	testdir="$(MODULE_TESTS_$(shell echo $@ | cut -d '-' -f 3-))" ; \
+	if [ -z "$$testdir" ]; then \
+		echo "---> Skipping, no tests defined for $$module module" ; \
+		exit 0 ; \
+	fi ; \
+	pwd=`pwd` ; \
+	globals= ; \
+	if [ "$$module" = "modsecurity" ]; then \
+		export LD_LIBRARY_PATH=$$pwd/abuild-module-modsecurity/src/modsecurity-v$(MODSECURITY_VERSION)/local/lib ; \
+	fi ; \
+	for so in `find module-$${module}/ -maxdepth 1 -type f -name "*module.so"`; do \
+		globals="$$globals load_module $$pwd/$$so;" ; \
+	done ; \
+	if [ ! -d nginx-tests/module-$${module} ]; then \
+		cp -r $${pwd}/abuild-module-$${module}/src/$${testdir} nginx-tests/module-$${module} ; \
+		ln -fs ../lib nginx-tests/module-$${module}/lib ; \
+	fi ; \
+	cd nginx-tests/module-$${module} && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
 	}
 
 clean:
-	@rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests
+	@rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests .deps-module-*
 
 .PHONY:	default all modules abuild test test-debug clean
 
diff --git a/alpine/Makefile.module-brotli b/alpine/Makefile.module-brotli
new file mode 100644
index 0000000..6645b56
--- /dev/null
+++ b/alpine/Makefile.module-brotli
@@ -0,0 +1,39 @@
+MODULES+=	brotli
+
+MODULE_SUMMARY_brotli=	3rd-party brotli compression dynamic modules
+
+include $(CONTRIB)/src/ngx_brotli/version
+
+MODULE_VERSION_brotli=	$(NGX_BROTLI_VERSION)
+MODULE_RELEASE_brotli=	1
+
+MODULE_VERSION_PREFIX_brotli=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_brotli=	ngx_brotli-$(NGX_BROTLI_VERSION).tar.gz
+
+MODULE_CONFARGS_brotli=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_brotli-$(NGX_BROTLI_VERSION)rc
+
+.deps-module-brotli:
+	cd $(CONTRIB) && make .sum-ngx_brotli
+	touch $@
+
+MODULE_BUILD_DEPENDS_brotli=brotli-dev
+
+define MODULE_POST_brotli
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_brotli) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_brotli_filter_module.so;
+    load_module modules/ngx_http_brotli_static_module.so;
+
+Please refer to the modules documentation for further details:
+https://github.com/google/ngx_brotli
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_brotli
diff --git a/alpine/Makefile.module-encrypted-session b/alpine/Makefile.module-encrypted-session
new file mode 100644
index 0000000..1ea5fae
--- /dev/null
+++ b/alpine/Makefile.module-encrypted-session
@@ -0,0 +1,54 @@
+MODULES+=	encrypted-session
+
+MODULE_SUMMARY_encrypted_session=	3rd-party encrypted session dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/encrypted-session-nginx-module/version
+
+MODULE_VERSION_encrypted_session=	$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION)
+MODULE_RELEASE_encrypted_session=	1
+
+MODULE_VERSION_PREFIX_encrypted_session=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_encrypted_session= 	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+					encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_encrypted_session=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+					--add-dynamic-module=$(MODSRC_PREFIX)encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION)
+
+.deps-module-encrypted-session:
+	cd $(CONTRIB) && make \
+		.sum-ngx_devel_kit \
+		.sum-encrypted-session-nginx-module
+	touch $@
+
+prerequisites-for-module-encrypted-session: module-ndk
+
+MODULE_DEPENDS_encrypted_session=$(NDK_DEPENDENCY_TAG)
+
+define MODULE_PREINSTALL_encrypted_session
+	rm -f objs/ndk_http_module-debug.so
+	rm -f objs/ndk_http_module.so
+endef
+export MODULE_PREINSTALL_encrypted_session
+
+define MODULE_POST_encrypted_session
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_encrypted_session) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_encrypted_session_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+Please refer to the modules documentation for further details:
+https://github.com/openresty/encrypted-session-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_encrypted_session
diff --git a/alpine/Makefile.module-geoip b/alpine/Makefile.module-geoip
index 1b421d7..1b98c00 100644
--- a/alpine/Makefile.module-geoip
+++ b/alpine/Makefile.module-geoip
@@ -10,7 +10,6 @@
 			--with-stream_geoip_module=dynamic
 
 MODULE_BUILD_DEPENDS_geoip=geoip-dev
-MODULE_DEPENDS_geoip=geoip
 
 define MODULE_ADD_CONTROL_TAGS_geoip
 replaces="nginx-mod-http-geoip"
@@ -29,8 +28,8 @@
     load_module modules/ngx_stream_geoip_module.so;
 
 Please refer to the modules documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_geoip_module.html
-http://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
+https://nginx.org/en/docs/http/ngx_http_geoip_module.html
+https://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/alpine/Makefile.module-geoip2 b/alpine/Makefile.module-geoip2
new file mode 100644
index 0000000..39eebc0
--- /dev/null
+++ b/alpine/Makefile.module-geoip2
@@ -0,0 +1,42 @@
+MODULES+=	geoip2
+
+MODULE_SUMMARY_geoip2=	3rd-party GeoIP2 dynamic modules
+
+include $(CONTRIB)/src/ngx_http_geoip2_module/version
+
+MODULE_VERSION_geoip2=	$(GEOIP2_NGINX_MODULE_VERSION)
+MODULE_RELEASE_geoip2=	1
+
+MODULE_VERSION_PREFIX_geoip2=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_geoip2=	ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_geoip2=	--with-stream \
+			--add-dynamic-module=$(MODSRC_PREFIX)ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION)
+
+.deps-module-geoip2:
+	cd $(CONTRIB) && make .sum-ngx_http_geoip2_module
+	touch $@
+
+prerequisites-for-module-geoip2:
+
+MODULE_BUILD_DEPENDS_geoip2=libmaxminddb-dev
+
+define MODULE_POST_geoip2
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_geoip2) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_geoip2_module.so;
+    load_module modules/ngx_stream_geoip2_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/leev/ngx_http_geoip2_module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_geoip2
diff --git a/alpine/Makefile.module-headers-more b/alpine/Makefile.module-headers-more
new file mode 100644
index 0000000..168c677
--- /dev/null
+++ b/alpine/Makefile.module-headers-more
@@ -0,0 +1,40 @@
+MODULES+=	headers-more
+
+MODULE_SUMMARY_headers_more=	3rd-party headers-more dynamic module
+
+include $(CONTRIB)/src/headers-more-nginx-module/version
+
+MODULE_VERSION_headers_more=	$(HEADERS_MORE_NGINX_MODULE_VERSION)
+MODULE_RELEASE_headers_more=	1
+
+MODULE_VERSION_PREFIX_headers_more=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_headers_more=	headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_headers_more=	--with-http_dav_module \
+				--with-http_realip_module \
+				--add-dynamic-module=$(MODSRC_PREFIX)headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION)
+
+.deps-module-headers-more:
+	cd $(CONTRIB) && make .sum-headers-more-nginx-module
+	touch $@
+
+prerequisites-for-module-headers-more:
+
+define MODULE_POST_headers_more
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_headers_more) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_headers_more_filter_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/openresty/headers-more-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_headers_more
diff --git a/alpine/Makefile.module-image-filter b/alpine/Makefile.module-image-filter
index 7c874e6..f7e1dc6 100644
--- a/alpine/Makefile.module-image-filter
+++ b/alpine/Makefile.module-image-filter
@@ -7,7 +7,6 @@
 
 MODULE_CONFARGS_image_filter=	--with-http_image_filter_module=dynamic
 
-MODULE_DEPENDS_image_filter=libgd
 MODULE_BUILD_DEPENDS_image_filter=gd-dev
 
 define MODULE_ADD_CONTROL_TAGS_image_filter
@@ -26,7 +25,7 @@
     load_module modules/ngx_http_image_filter_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_image_filter_module.html
+https://nginx.org/en/docs/http/ngx_http_image_filter_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/alpine/Makefile.module-lua b/alpine/Makefile.module-lua
new file mode 100644
index 0000000..8d66272
--- /dev/null
+++ b/alpine/Makefile.module-lua
@@ -0,0 +1,117 @@
+MODULES+=	lua
+
+MODULE_SUMMARY_lua=	3rd-party Lua dynamic modules
+
+include $(CONTRIB)/src/luajit2/version
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/lua-nginx-module/version
+include $(CONTRIB)/src/stream-lua-nginx-module/version
+include $(CONTRIB)/src/lua-resty-core/version
+include $(CONTRIB)/src/lua-resty-lrucache/version
+
+MODULE_VERSION_lua=	$(LUA_NGINX_MODULE_VERSION)
+MODULE_RELEASE_lua=	1
+
+MODULE_VERSION_PREFIX_lua=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_lua=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+			lua-nginx-module-$(LUA_NGINX_MODULE_VERSION).tar.gz \
+			stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz \
+			luajit2-$(LUAJIT2_VERSION).tar.gz \
+			lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz \
+			lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz
+
+MODULE_PATCHES_lua=	$(CONTRIB)/src/luajit2/Makefile.patch \
+			$(CONTRIB)/src/luajit2/src-luaconf.h.patch \
+			$(CONTRIB)/src/lua-nginx-module/config.patch \
+			$(CONTRIB)/src/stream-lua-nginx-module/config.patch
+
+MODULE_CONFARGS_lua=	--with-http_dav_module \
+			--with-http_realip_module \
+			--with-http_ssl_module \
+			--with-http_v2_module \
+			--with-stream \
+			--with-stream_ssl_module \
+			--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+			--add-dynamic-module=$(MODSRC_PREFIX)lua-nginx-module-$(LUA_NGINX_MODULE_VERSION) \
+			--add-dynamic-module=$(MODSRC_PREFIX)stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION)
+
+.deps-module-lua:
+	cd $(CONTRIB) && make \
+		.sum-luajit2 \
+		.sum-ngx_devel_kit \
+		.sum-lua-nginx-module \
+		.sum-stream-lua-nginx-module \
+		.sum-lua-resty-core \
+		.sum-lua-resty-lrucache
+	touch $@
+
+prerequisites-for-module-lua: module-ndk
+
+MODULE_DEPENDS_lua=$(NDK_DEPENDENCY_TAG)
+
+define MODULE_PREBUILD_lua
+	cd ../luajit2-$(LUAJIT2_VERSION) \&\& \
+	DESTDIR=`pwd` CFLAGS="-fPIC" make $$_make_opts install
+endef
+export MODULE_PREBUILD_lua
+
+define MODULE_ENV_lua
+LUAJIT_INC="../luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1" LUAJIT_LIB="../luajit2-$(LUAJIT2_VERSION)/usr/lib"
+endef
+export MODULE_ENV_lua
+
+define MODULE_PREINSTALL_lua
+	rm -f objs/ndk_http_module-debug.so
+	rm -f objs/ndk_http_module.so
+	mkdir -p "$$pkgdir"/usr/bin
+	mkdir -p "$$pkgdir"/usr/share/man/man1
+        install -m755 ../luajit2-$(LUAJIT2_VERSION)/usr/bin/luajit "$$pkgdir"/usr/bin/nginx-luajit
+        install -m644 ../luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/luajit.1 "$$pkgdir"/usr/share/man/man1/nginx-luajit.1
+	if [ -z "`echo $subpackages | grep -- -doc`" ]; then
+		gzip "$$pkgdir"/usr/share/man/man1/nginx-luajit.1
+	fi
+	mkdir -p "$$pkgdir"/usr/share/nginx-luajit-2.1/jit
+        for f in `find ../luajit2-$(LUAJIT2_VERSION)/usr/share/nginx-luajit-2.1/jit/ -type f`; do \
+                install -m644 $${f} "$$pkgdir"/usr/share/nginx-luajit-2.1/jit/ ; \
+        done
+	mkdir -p "$$pkgdir"/usr/include/nginx-luajit-2.1
+        for f in `find ../luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1/ -type f`; do \
+                install -m644 $${f} "$$pkgdir"/usr/include/nginx-luajit-2.1/ ; \
+        done
+	mkdir -p "$$pkgdir"/usr/share/nginx-luajit-2.1/resty
+	( cd ../lua-resty-core-$(LUA_RESTY_CORE_VERSION) \&\& \
+		LUA_LIB_DIR="$$pkgdir"/usr/share/nginx-luajit-2.1 make install )
+	( cd ../lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION) \&\& \
+		LUA_LIB_DIR="$$pkgdir"/usr/share/nginx-luajit-2.1 make install )
+
+endef
+export MODULE_PREINSTALL_lua
+
+define MODULE_POST_lua
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_lua) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_lua_module.so;
+    load_module modules/ngx_stream_lua_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+These modules are compiled with LuaJIT 2.1 library.
+The following binary should be used for testing and bytecode generation:
+
+    /usr/bin/nginx-luajit
+
+Please refer to the modules documentation for further details:
+https://github.com/openresty/lua-nginx-module
+https://github.com/openresty/stream-lua-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_lua
diff --git a/alpine/Makefile.module-modsecurity b/alpine/Makefile.module-modsecurity
new file mode 100644
index 0000000..3737429
--- /dev/null
+++ b/alpine/Makefile.module-modsecurity
@@ -0,0 +1,84 @@
+MODULES+=	modsecurity
+
+MODULE_SUMMARY_modsecurity=	3rd-party ModSecurity dynamic module
+
+include $(CONTRIB)/src/modsecurity/version
+include $(CONTRIB)/src/modsecurity-nginx/version
+
+MODULE_VERSION_modsecurity=	$(MODSECURITY_NGINX_VERSION)
+MODULE_RELEASE_modsecurity=	1
+LIBMODSECURITY_SOVER=		$(MODSECURITY_VERSION)
+
+MODULE_VERSION_PREFIX_modsecurity=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_modsecurity=	modsecurity-v$(MODSECURITY_VERSION).tar.gz \
+				modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz
+
+MODULE_PATCHES_modsecurity=	$(CONTRIB)/src/modsecurity/PR2348.patch \
+				$(CONTRIB)/src/modsecurity-nginx/PR165.patch
+
+MODULE_CONFARGS_modsecurity=	--add-dynamic-module=$(MODSRC_PREFIX)modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)
+
+.deps-module-modsecurity:
+	cd $(CONTRIB) && make \
+		.sum-modsecurity \
+		.sum-modsecurity-nginx
+	touch $@
+
+prerequisites-for-module-modsecurity:
+
+MODULE_BUILD_DEPENDS_modsecurity=yajl-dev libxml2-dev curl-dev patchelf
+
+define MODULE_PREBUILD_modsecurity
+	cd ../modsecurity-v$(MODSECURITY_VERSION) \&\& \
+	./configure --prefix `pwd`/local --without-lmdb --without-lua \&\& \
+	make $$_make_opts install \&\& make check-TESTS
+	rm -f /tmp/audit_test.log /tmp/audit_test_parallel.log
+	rm -rf /tmp/test
+endef
+export MODULE_PREBUILD_modsecurity
+
+define MODULE_ENV_modsecurity
+MODSECURITY_INC="../modsecurity-v$(MODSECURITY_VERSION)/local/include" \
+MODSECURITY_LIB="../modsecurity-v$(MODSECURITY_VERSION)/local/lib" \
+NGX_IGNORE_RPATH=YES
+endef
+export MODULE_ENV_modsecurity
+
+MODULE_CC_OPT_DEBUG_modsecurity=-DMODSECURITY_DDEBUG=1
+
+define MODULE_PREINSTALL_modsecurity
+	mkdir -p "$$pkgdir"/usr/bin
+	install -m755 -s ../modsecurity-v$(MODSECURITY_VERSION)/local/bin/modsec-rules-check "$$pkgdir"/usr/bin/
+	patchelf --remove-rpath "$$pkgdir"/usr/bin/modsec-rules-check
+	mkdir -p "$$pkgdir"/usr/lib
+	install -m755 ../modsecurity-v$(MODSECURITY_VERSION)/local/lib/libmodsecurity.so.$(LIBMODSECURITY_SOVER) "$$pkgdir"/usr/lib/
+	ln -fs libmodsecurity.so.$(LIBMODSECURITY_SOVER) "$$pkgdir"/usr/lib/libmodsecurity.so.3
+	ln -fs libmodsecurity.so.$(LIBMODSECURITY_SOVER) "$$pkgdir"/usr/lib/libmodsecurity.so
+	mkdir -p "$$pkgdir"/etc/nginx/modsec
+	install -m644 ../modsecurity-v$(MODSECURITY_VERSION)/modsecurity.conf-recommended "$$pkgdir"/etc/nginx/modsec/modsecurity.conf
+	install -m644 ../modsecurity-v$(MODSECURITY_VERSION)/unicode.mapping "$$pkgdir"/etc/nginx/modsec/
+endef
+export MODULE_PREINSTALL_modsecurity
+
+MODULE_TESTS_modsecurity=modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)/tests
+
+define MODULE_POST_modsecurity
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_modsecurity) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_modsecurity_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/SpiderLabs/ModSecurity-nginx
+
+----------------------------------------------------------------------
+BANNER
+
+/sbin/ldconfig
+endef
+export MODULE_POST_modsecurity
diff --git a/alpine/Makefile.module-ndk b/alpine/Makefile.module-ndk
new file mode 100644
index 0000000..6044916
--- /dev/null
+++ b/alpine/Makefile.module-ndk
@@ -0,0 +1,47 @@
+MODULES+=	ndk
+
+MODULE_SUMMARY_ndk=	3rd-party NDK dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+
+MODULE_VERSION_ndk=	$(NGX_DEVEL_KIT_VERSION)
+MODULE_RELEASE_ndk=	1
+
+MODULE_VERSION_PREFIX_ndk=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_ndk=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz
+
+MODULE_CONFARGS_ndk=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION)
+
+.deps-module-ndk:
+	cd $(CONTRIB) && make .sum-ngx_devel_kit
+	touch $@
+
+prerequisites-for-module-ndk:
+
+MODULE_CC_OPT_ndk=-DNDK_SET_VAR -DNDK_UPSTREAM_LIST
+MODULE_CC_OPT_DEBUG_ndk=$(MODULE_CC_OPT_ndk)
+
+ifeq ($(MODULE_TARGET), plus)
+NDK_DEPENDENCY_TAG=nginx-plus-module-ndk-r$(PLUS_VERSION)
+else
+NDK_DEPENDENCY_TAG=nginx-module-ndk-r$(BASE_VERSION)
+endif
+
+define MODULE_POST_ndk
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_ndk) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/simpl/ngx_devel_kit
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_ndk
diff --git a/alpine/Makefile.module-njs b/alpine/Makefile.module-njs
index b75d573..ca0112a 100644
--- a/alpine/Makefile.module-njs
+++ b/alpine/Makefile.module-njs
@@ -1,13 +1,20 @@
 MODULES+=	njs
 
-MODULE_SUMMARY_njs=		njs dynamic modules
+MODULE_SUMMARY_njs=	njs dynamic modules
 
-MODULE_VERSION_njs=		0.5.0
-MODULE_RELEASE_njs=		1
+include $(CONTRIB)/src/njs/version
 
-MODULE_SOURCES_njs=		njs-$(MODULE_VERSION_njs).tar.gz
-MODULE_CONFARGS_njs=		--with-stream \
-				--add-dynamic-module=$(MODSRC_PREFIX)njs-$(MODULE_VERSION_njs)/nginx
+MODULE_VERSION_njs=	$(NJS_VERSION)
+MODULE_RELEASE_njs=	1
+
+MODULE_SOURCES_njs=	njs-$(NJS_VERSION).tar.gz
+
+MODULE_CONFARGS_njs=	--with-stream \
+			--add-dynamic-module=$(MODSRC_PREFIX)njs-$(NJS_VERSION)/nginx
+
+.deps-module-njs:
+	cd $(CONTRIB) && make .sum-njs
+	touch $@
 
 MODULE_VERSION_PREFIX_njs=$(MODULE_TARGET_PREFIX)
 MODULE_BUILD_DEPENDS_njs=libedit-dev
@@ -18,15 +25,15 @@
 export MODULE_ADD_CONTROL_TAGS_njs
 
 define MODULE_PREBUILD_njs
-	cd ../njs-$(MODULE_VERSION_njs) \&\& ./configure \&\& make njs
+	cd ../njs-$(NJS_VERSION) \&\& ./configure \&\& make njs
 endef
 export MODULE_PREBUILD_njs
 
 define MODULE_PREINSTALL_njs
 	mkdir -p "$$pkgdir"/usr/share/doc/nginx-module-njs
-	install -m644 ../njs-$(MODULE_VERSION_njs)/CHANGES "$$pkgdir"/usr/share/doc/nginx-module-njs/
+	install -m644 ../njs-$(NJS_VERSION)/CHANGES "$$pkgdir"/usr/share/doc/nginx-module-njs/
 	mkdir -p "$$pkgdir"/usr/bin
-	install -m755 -s ../njs-$(MODULE_VERSION_njs)/build/njs "$$pkgdir"/usr/bin/
+	install -m755 -s ../njs-$(NJS_VERSION)/build/njs "$$pkgdir"/usr/bin/
 endef
 export MODULE_PREINSTALL_njs
 
@@ -42,9 +49,9 @@
     load_module modules/ngx_stream_js_module.so;
 
 Please refer to the modules documentation for further details:
-http://nginx.org/en/docs/njs/
-http://nginx.org/en/docs/http/ngx_http_js_module.html
-http://nginx.org/en/docs/stream/ngx_stream_js_module.html
+https://nginx.org/en/docs/njs/
+https://nginx.org/en/docs/http/ngx_http_js_module.html
+https://nginx.org/en/docs/stream/ngx_stream_js_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/alpine/Makefile.module-opentracing b/alpine/Makefile.module-opentracing
new file mode 100644
index 0000000..784a13c
--- /dev/null
+++ b/alpine/Makefile.module-opentracing
@@ -0,0 +1,94 @@
+MODULES+=	opentracing
+
+MODULE_SUMMARY_opentracing=	3rd-party OpenTracing dynamic module
+
+include $(CONTRIB)/src/opentracing-cpp/version
+include $(CONTRIB)/src/nginx-opentracing/version
+include $(CONTRIB)/src/jaeger-client-cpp/version
+
+MODULE_VERSION_opentracing=	$(NGINX_OPENTRACING_VERSION)
+MODULE_RELEASE_opentracing=	1
+
+MODULE_VERSION_PREFIX_opentracing=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_opentracing=	opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz \
+				nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz \
+				jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz
+
+MODULE_PATCHES_opentracing=	$(CONTRIB)/src/opentracing-cpp/CMakeLists.txt.patch \
+				$(CONTRIB)/src/jaeger-client-cpp/CMakeLists.txt.patch
+
+MODULE_CONFARGS_opentracing=	--add-dynamic-module=$(MODSRC_PREFIX)nginx-opentracing-$(NGINX_OPENTRACING_VERSION)/opentracing
+
+.deps-module-opentracing:
+	cd $(CONTRIB) && make \
+		.sum-opentracing-cpp \
+		.sum-nginx-opentracing \
+		.sum-jaeger-client-cpp
+	touch $@
+
+prerequisites-for-module-opentracing:
+
+MODULE_BUILD_DEPENDS_opentracing=cmake yaml-cpp-dev
+
+define MODULE_PREBUILD_opentracing
+	( cd ../opentracing-cpp-$(OPENTRACING_CPP_VERSION) \&\& \
+		mkdir .build \&\& \
+		cd .build \&\& \
+		cmake .. \&\& \
+		DESTDIR=`pwd`/.. make $$_make_opts install )
+	( cd ../jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION) \&\& \
+		mkdir .build \&\& \
+		cd .build \&\& \
+		OpenTracing_DIR=$$builddir/../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/.build cmake -DCMAKE_BUILD_TYPE=Release -DJAEGERTRACING_PLUGIN=ON -DHUNTER_CONFIGURATION_TYPES=Release -DBUILD_TESTING=OFF ../ -DOPENTRACING_INC=$$builddir/../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include \&\& \
+		DESTDIR=`pwd`/.. make $$_make_opts )
+endef
+export MODULE_PREBUILD_opentracing
+
+MODULE_CC_OPT_opentracing=-I../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include
+MODULE_CC_OPT_DEBUG_opentracing=$(MODULE_CC_OPT_opentracing)
+MODULE_LD_OPT_opentracing=-L../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib
+MODULE_LD_OPT_DEBUG_opentracing=$(MODULE_LD_OPT_opentracing)
+
+define MODULE_PREINSTALL_opentracing
+	mkdir -p "$$pkgdir"/usr/lib
+	install -m755 ../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing.so.$(OPENTRACING_CPP_VERSION) "$$pkgdir"/usr/lib/
+	ln -fs libopentracing.so.$(OPENTRACING_CPP_VERSION) "$$pkgdir"/usr/lib/libopentracing.so.1
+	ln -fs libopentracing.so.1 "$$pkgdir"/usr/lib/libopentracing.so
+	install -m755 ../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) "$$pkgdir"/usr/lib/
+	ln -fs libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) "$$pkgdir"/usr/lib/libopentracing_mocktracer.so.1
+	ln -fs libopentracing_mocktracer.so.1 "$$pkgdir"/usr/lib/libmodsecurity_mocktracer.so
+	mkdir -p "$$pkgdir"/usr/include
+	cp -pr ../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include/opentracing "$$pkgdir"/usr/include/
+	mkdir -p "$$pkgdir"/usr/libexec/opentracing
+	install -m755 ../jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION)/.build/libjaegertracing_plugin.so "$$pkgdir"/usr/libexec/opentracing/
+endef
+export MODULE_PREINSTALL_opentracing
+
+define MODULE_POST_opentracing
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_opentracing) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_opentracing_module.so;
+
+Note that additional tracer plugins are required in order
+to communicate with corresponding services (e.g. Zipkin, Jaeger).
+This package includes the Jaeger dynamic tracer plugin:
+
+    /usr/libexec/opentracing/libjaegertracing_plugin.so
+
+Please refer to the module documentation for further details:
+https://github.com/opentracing-contrib/nginx-opentracing
+https://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md
+
+OpenTracing project site (general info and documentation):
+http://opentracing.io/
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_opentracing
diff --git a/alpine/Makefile.module-passenger b/alpine/Makefile.module-passenger
new file mode 100644
index 0000000..69a693e
--- /dev/null
+++ b/alpine/Makefile.module-passenger
@@ -0,0 +1,44 @@
+MODULES+=	passenger
+
+MODULE_SUMMARY_passenger=	3rd-party Passenger dynamic module
+
+include $(CONTRIB)/src/passenger/version
+
+MODULE_VERSION_passenger=	$(PASSENGER_VERSION)
+MODULE_RELEASE_passenger=	1
+
+MODULE_VERSION_PREFIX_passenger=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_passenger=	passenger-$(PASSENGER_VERSION).tar.gz
+
+MODULE_PATCHES_passenger=	$(CONTRIB)/src/passenger/build-nginx.rb.patch \
+				$(CONTRIB)/src/passenger/src-nginx_module-ContentHandler.c.patch
+
+MODULE_CONFARGS_passenger=	--with-http_ssl_module \
+				--add-dynamic-module=$(MODSRC_PREFIX)passenger-$(PASSENGER_VERSION)/src/nginx_module
+
+.deps-module-passenger:
+	cd $(CONTRIB) && make .sum-passenger
+	touch $@
+
+prerequisites-for-module-passenger:
+
+MODULE_BUILD_DEPENDS_passenger=ruby-dev ruby-rake ruby-etc
+
+define MODULE_POST_passenger
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_passenger) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_passenger_module.so;
+
+Please refer to the module documentation for further details:
+https://www.phusionpassenger.com/
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_passenger
diff --git a/alpine/Makefile.module-perl b/alpine/Makefile.module-perl
index 330dd48..22a6fe2 100644
--- a/alpine/Makefile.module-perl
+++ b/alpine/Makefile.module-perl
@@ -34,7 +34,7 @@
     load_module modules/ngx_http_perl_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_perl_module.html
+https://nginx.org/en/docs/http/ngx_http_perl_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/alpine/Makefile.module-rtmp b/alpine/Makefile.module-rtmp
new file mode 100644
index 0000000..d205e94
--- /dev/null
+++ b/alpine/Makefile.module-rtmp
@@ -0,0 +1,40 @@
+MODULES+=	rtmp
+
+MODULE_SUMMARY_rtmp=	3rd-party RTMP dynamic module
+
+include $(CONTRIB)/src/nginx-rtmp-module/version
+
+MODULE_VERSION_rtmp=	$(NGINX_RTMP_MODULE_VERSION)
+MODULE_RELEASE_rtmp=	1
+
+MODULE_VERSION_PREFIX_rtmp=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_rtmp=	nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION).tar.gz
+
+MODULE_PATCHES_rtmp=	$(CONTRIB)/src/nginx-rtmp-module/PR1340.patch
+
+MODULE_CONFARGS_rtmp=	--add-dynamic-module=$(MODSRC_PREFIX)nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION)
+
+.deps-module-rtmp:
+	cd $(CONTRIB) && make .sum-nginx-rtmp-module
+	touch $@
+
+prerequisites-for-module-rtmp:
+
+define MODULE_POST_rtmp
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_rtmp) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_rtmp_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/arut/nginx-rtmp-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_rtmp
diff --git a/alpine/Makefile.module-set-misc b/alpine/Makefile.module-set-misc
new file mode 100644
index 0000000..ef9eae8
--- /dev/null
+++ b/alpine/Makefile.module-set-misc
@@ -0,0 +1,55 @@
+MODULES+=	set-misc
+
+MODULE_SUMMARY_set_misc=	3rd-party set-misc dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/set-misc-nginx-module/version
+
+MODULE_VERSION_set_misc=	$(SET_MISC_NGINX_MODULE_VERSION)
+MODULE_RELEASE_set_misc=	1
+
+MODULE_VERSION_PREFIX_set_misc=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_set_misc=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+				set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_set_misc=	--with-http_ssl_module \
+				--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+				--add-dynamic-module=$(MODSRC_PREFIX)set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION)
+
+.deps-module-set-misc:
+	cd $(CONTRIB) && make \
+		.sum-ngx_devel_kit \
+		.sum-set-misc-nginx-module
+	touch $@
+
+prerequisites-for-module-set-misc: module-ndk
+
+MODULE_DEPENDS_set_misc=$(NDK_DEPENDENCY_TAG)
+
+define MODULE_PREINSTALL_set_misc
+	rm -f objs/ndk_http_module-debug.so
+	rm -f objs/ndk_http_module.so
+endef
+export MODULE_PREINSTALL_set_misc
+
+define MODULE_POST_set_misc
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_set_misc) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_set_misc_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+Please refer to the module documentation for further details:
+https://github.com/openresty/set-misc-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_set_misc
diff --git a/alpine/Makefile.module-subs-filter b/alpine/Makefile.module-subs-filter
new file mode 100644
index 0000000..6b5213a
--- /dev/null
+++ b/alpine/Makefile.module-subs-filter
@@ -0,0 +1,38 @@
+MODULES+=	subs-filter
+
+MODULE_SUMMARY_subs_filter=	3rd-party substitution dynamic module
+
+include $(CONTRIB)/src/ngx_http_substitutions_filter_module/version
+
+MODULE_VERSION_subs_filter=	$(SUBSTITUTIONS_FILTER_NGINX_MODULE_VERSION)
+MODULE_RELEASE_subs_filter=	1
+
+MODULE_VERSION_PREFIX_subs_filter=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_subs_filter=	ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH).tar.xz
+
+MODULE_CONFARGS_subs_filter=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH)
+
+.deps-module-subs-filter:
+	cd $(CONTRIB) && make .sum-ngx_http_substitutions_filter_module
+	touch $@
+
+prerequisites-for-module-subs-filter:
+
+define MODULE_POST_subs_filter
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_subs_filter) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_subs_filter_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/yaoweibin/ngx_http_substitutions_filter_module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_subs_filter
diff --git a/alpine/Makefile.module-xslt b/alpine/Makefile.module-xslt
index f4674a1..1329c48 100644
--- a/alpine/Makefile.module-xslt
+++ b/alpine/Makefile.module-xslt
@@ -7,7 +7,6 @@
 
 MODULE_CONFARGS_xslt=		--with-http_xslt_module=dynamic
 
-MODULE_DEPENDS_xslt=libxslt
 MODULE_BUILD_DEPENDS_xslt=libxslt-dev
 
 define MODULE_ADD_CONTROL_TAGS_xslt
@@ -26,7 +25,7 @@
     load_module modules/ngx_http_xslt_filter_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_xslt_module.html
+https://nginx.org/en/docs/http/ngx_http_xslt_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/alpine/nginx.post-install b/alpine/nginx.post-install
index 13e7299..102c3e7 100644
--- a/alpine/nginx.post-install
+++ b/alpine/nginx.post-install
@@ -6,14 +6,14 @@
 Thanks for using nginx!
 
 Please find the official documentation for nginx here:
-* http://nginx.org/en/docs/
+* https://nginx.org/en/docs/
 
 Please subscribe to nginx-announce mailing list to get
 the most important news about nginx:
-* http://nginx.org/en/support.html
+* https://nginx.org/en/support.html
 
 Commercial subscriptions for nginx are available on:
-* http://nginx.com/products/
+* https://nginx.com/products/
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/alpine/src/njs-0.5.0.tar.gz b/alpine/src/njs-0.5.0.tar.gz
deleted file mode 100644
index 688acfe..0000000
--- a/alpine/src/njs-0.5.0.tar.gz
+++ /dev/null
Binary files differ
diff --git a/contrib/.hgignore b/contrib/.hgignore
new file mode 100644
index 0000000..55586f6
--- /dev/null
+++ b/contrib/.hgignore
@@ -0,0 +1,2 @@
+syntax:glob
+.sum-*
diff --git a/contrib/Makefile b/contrib/Makefile
new file mode 100644
index 0000000..27addce
--- /dev/null
+++ b/contrib/Makefile
@@ -0,0 +1,143 @@
+all: install
+
+TOPSRC := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+SRC := $(TOPSRC)/src
+TARBALLS := $(TOPSRC)/tarballs
+VPATH := $(TARBALLS)
+PREFIX = $(TOPSRC)/local
+PREFIX := $(abspath $(PREFIX))
+
+PKGS_ALL := $(patsubst $(SRC)/%/Makefile,%,$(wildcard $(SRC)/*/Makefile))
+
+# Common download locations
+NGINX := https://nginx.org/download
+CONTRIB_NGINX := https://packages.nginx.org/contrib
+GITHUB := https://github.com
+
+#
+# Tools
+#
+NPROC := $(shell getconf _NPROCESSORS_ONLN)
+_SMP_MFLAGS := -j$(NPROC)
+
+ifndef GIT
+ifeq ($(shell git --version >/dev/null 2>&1 || echo FAIL),)
+GIT = git
+endif
+endif
+GIT ?= $(error git not found)
+
+ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
+download = curl -f -L -- "$(1)" > "$@"
+else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
+download = (rm -f $@.tmp && \
+	wget --passive -c -p -O $@.tmp "$(1)" && \
+	touch $@.tmp && \
+	mv $@.tmp $@ )
+else ifeq ($(which fetch >/dev/null 2>&1 || echo FAIL),)
+download = (rm -f $@.tmp && \
+	fetch -p -o $@.tmp "$(1)" && \
+	touch $@.tmp && \
+	mv $@.tmp $@)
+else
+download = $(error Neither curl nor wget found)
+endif
+
+download_pkg = $(call download,$(CONTRIB_NGINX)/$(2)/$(lastword $(subst /, ,$(@)))) || \
+	( $(call download,$(1)) && echo "Please upload $(lastword $(subst /, ,$(@))) to $(CONTRIB_NGINX)" )
+
+ifeq ($(shell which xz >/dev/null 2>&1 || echo FAIL),)
+XZ = xz
+else
+XZ ?= $(error XZ (LZMA) compressor not found)
+endif
+
+ifeq ($(shell sha512sum --version >/dev/null 2>&1 || echo FAIL),)
+SHA512SUM = sha512sum --check
+else ifeq ($(shell shasum --version >/dev/null 2>&1 || echo FAIL),)
+SHA512SUM = shasum -a 512 --check
+else ifeq ($(shell openssl version >/dev/null 2>&1 || echo FAIL),)
+SHA512SUM = openssl dgst -sha512
+else
+SHA512SUM = $(error SHA-512 checksumming not found)
+endif
+
+#
+# Common helpers
+#
+download_git = \
+	rm -Rf -- "$(@:.tar.xz=)" && \
+	$(GIT) init --bare "$(@:.tar.xz=)" && \
+	(cd "$(@:.tar.xz=)" && \
+	$(GIT) remote add origin "$(1)" && \
+	$(GIT) fetch origin "$(2)") && \
+	(cd "$(@:.tar.xz=)" && \
+	$(GIT) archive --prefix="$(notdir $(@:.tar.xz=))/" \
+		--format=tar "$(3)") > "$(@:.xz=)" && \
+	echo "$(3) $(@)" > "$(@:.tar.xz=.githash)" && \
+	rm -Rf -- "$(@:.tar.xz=)" && \
+	$(XZ) --stdout "$(@:.xz=)" > "$@.tmp" && \
+	rm -f "$(@:.xz=)" && \
+	mv -f -- "$@.tmp" "$@"
+check_githash = \
+	h=`sed -e "s,^\([0-9a-fA-F]\{40\}\) .*/$(notdir $<),\1,g" \
+		< "$(<:.tar.xz=.githash)"` && \
+	test "$$h" = "$1"
+
+checksum = \
+	$(foreach f,$(filter $(TARBALLS)/%,$^), \
+		grep -- " $(f:$(TARBALLS)/%=%)$$" \
+			"$(SRC)/$(patsubst $(3)%,%,$@)/$(2)SUMS" &&) \
+	(cd $(TARBALLS) && $(1) /dev/stdin) < \
+		"$(SRC)/$(patsubst $(3)%,%,$@)/$(2)SUMS"
+CHECK_SHA512 = $(call checksum,$(SHA512SUM),SHA512,.sum-)
+UNPACK = $(RM) -R $@ \
+	$(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzfo $(f)) \
+	$(foreach f,$(filter %.tar.bz2,$^), && tar xvjfo $(f)) \
+	$(foreach f,$(filter %.tar.xz,$^), && tar xvJfo $(f)) \
+	$(foreach f,$(filter %.zip,$^), && unzip $(f))
+UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<)))
+APPLY = (cd $(UNPACK_DIR) && patch -fp1) <
+MOVE = mv $(UNPACK_DIR) $@ && touch $@
+
+# Per-package build rules
+include $(SRC)/*/Makefile
+
+# Targets
+PKGS_DEPS := $(sort $(foreach p,$(PKGS),$(DEPS_$(p))))
+
+fetch: $(PKGS:%=.sum-%)
+install: $(PKGS:%=.%)
+
+clean:
+	-$(RM) $(foreach p,$(PKGS),.$(p) .sum-$(p) .dep-$(p))
+	-$(RM) -R $(foreach p,$(PKGS),$(p))
+	-$(RM) -R "$(PREFIX)"
+	-$(RM) $(TARBALLS)/*.*
+
+list:
+	@echo Packages:
+	@echo '  $(PKGS)' | tr " " "\n" | sort | tr "\n" " " |fmt
+	@echo Depended-on packages:
+	@echo '  $(PKGS_DEPS)' | tr " " "\n" | sort | tr "\n" " " |fmt
+
+.PHONY: all fetch install clean list
+
+# Default pattern rules
+.sum-%: $(SRC)/%/SHA512SUMS
+	$(CHECK_SHA512)
+	touch $@
+
+.sum-%:
+	$(error Download and check target not defined for $*)
+
+# Real dependency on missing packages
+$(patsubst %,.dep-%,$(PKGS)): .dep-%: .%
+	touch -r $< $@
+
+.SECONDEXPANSION:
+
+# Dependency propagation (convert 'DEPS_foo = bar' to '.foo: .bar')
+$(foreach p,$(PKGS),.$(p)): .%: $$(foreach d,$$(DEPS_$$*),.dep-$$(d))
+
+.DELETE_ON_ERROR:
diff --git a/contrib/src/encrypted-session-nginx-module/Makefile b/contrib/src/encrypted-session-nginx-module/Makefile
new file mode 100644
index 0000000..10afec9
--- /dev/null
+++ b/contrib/src/encrypted-session-nginx-module/Makefile
@@ -0,0 +1,20 @@
+# encrypted-session-nginx-module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+ENCRYPTED_SESSION_NGINX_MODULE_URL := $(GITHUB)/openresty/encrypted-session-nginx-module/archive/v$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz
+
+PKGS += encrypted-session-nginx-module
+
+$(TARBALLS)/encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(ENCRYPTED_SESSION_NGINX_MODULE_URL),encrypted-session-nginx-module)
+
+.sum-encrypted-session-nginx-module: encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz
+
+encrypted-session-nginx-module: encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz .sum-encrypted-session-nginx-module
+	$(UNPACK)
+	$(MOVE)
+
+DEPS_encrypted-session-nginx-module = ngx_devel_kit $(DEPS_ngx_devel_kit)
+
+.encrypted-session-nginx-module: encrypted-session-nginx-module
+	touch $@
diff --git a/contrib/src/encrypted-session-nginx-module/SHA512SUMS b/contrib/src/encrypted-session-nginx-module/SHA512SUMS
new file mode 100644
index 0000000..a91d560
--- /dev/null
+++ b/contrib/src/encrypted-session-nginx-module/SHA512SUMS
@@ -0,0 +1 @@
+80651951edd69d202e991a66f531bbe0398b4f062e822bb7748411f5f597eb1d5827102ba477bb6cd2793274adf6f6d60dd89fde7645174b091143251197af69  encrypted-session-nginx-module-0.08.tar.gz
diff --git a/contrib/src/encrypted-session-nginx-module/version b/contrib/src/encrypted-session-nginx-module/version
new file mode 100644
index 0000000..c043551
--- /dev/null
+++ b/contrib/src/encrypted-session-nginx-module/version
@@ -0,0 +1 @@
+ENCRYPTED_SESSION_NGINX_MODULE_VERSION := 0.08
diff --git a/contrib/src/headers-more-nginx-module/Makefile b/contrib/src/headers-more-nginx-module/Makefile
new file mode 100644
index 0000000..0601976
--- /dev/null
+++ b/contrib/src/headers-more-nginx-module/Makefile
@@ -0,0 +1,18 @@
+# headers-more-nginx-module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+HEADERS_MORE_NGINX_MODULE_URL := $(GITHUB)/openresty/headers-more-nginx-module/archive/v$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz
+
+PKGS += headers-more-nginx-module
+
+$(TARBALLS)/headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(HEADERS_MORE_NGINX_MODULE_URL),headers-more-nginx-module)
+
+.sum-headers-more-nginx-module: headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz
+
+headers-more-nginx-module: headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz .sum-headers-more-nginx-module
+	$(UNPACK)
+	$(MOVE)
+
+.headers-more-nginx-module: headers-more-nginx-module
+	touch $@
diff --git a/contrib/src/headers-more-nginx-module/SHA512SUMS b/contrib/src/headers-more-nginx-module/SHA512SUMS
new file mode 100644
index 0000000..e2f3bde
--- /dev/null
+++ b/contrib/src/headers-more-nginx-module/SHA512SUMS
@@ -0,0 +1 @@
+13165b1b8d4be281b8bd2404fa48d456013d560bace094c81da08a35dc6a4f025a809a3ae3a42be6bbf67abbcbe41e0730aba06f905220f3baeb01e1192a7d37  headers-more-nginx-module-0.33.tar.gz
diff --git a/contrib/src/headers-more-nginx-module/version b/contrib/src/headers-more-nginx-module/version
new file mode 100644
index 0000000..53ac4c1
--- /dev/null
+++ b/contrib/src/headers-more-nginx-module/version
@@ -0,0 +1 @@
+HEADERS_MORE_NGINX_MODULE_VERSION := 0.33
diff --git a/contrib/src/jaeger-client-cpp/CMakeLists.txt.patch b/contrib/src/jaeger-client-cpp/CMakeLists.txt.patch
new file mode 100644
index 0000000..9341f09
--- /dev/null
+++ b/contrib/src/jaeger-client-cpp/CMakeLists.txt.patch
@@ -0,0 +1,44 @@
+--- a/CMakeLists.txt	2020-06-08 15:24:23.000000000 +0000
++++ b/CMakeLists.txt	2020-12-10 14:06:50.510344080 +0000
+@@ -69,18 +69,11 @@
+ list(APPEND package_deps thrift)

+ 

+ 

+-hunter_add_package(opentracing-cpp)

+-# Not `${hunter_config}` because OpenTracing provides its own

+-# OpenTracingConfig.cmake file

++# use our own prebuilt version of opentracing-cpp

++include_directories(${OPENTRACING_INC})

+ find_package(OpenTracing CONFIG REQUIRED)

+-# Under Windows, link dynamically with OpenTracing

+-if (WIN32)

+-  list(APPEND LIBS OpenTracing::opentracing)

+-  set(OPENTRACING_LIB OpenTracing::opentracing)

+-else()

+-  list(APPEND LIBS OpenTracing::opentracing-static)

+-  set(OPENTRACING_LIB OpenTracing::opentracing-static)

+-endif()

++list(APPEND LIBS OpenTracing::opentracing-static)

++set(OPENTRACING_LIB OpenTracing::opentracing-static)

+ list(APPEND package_deps OpenTracing)

+ 

+ hunter_add_package(nlohmann_json)

+@@ -97,16 +90,8 @@
+   "NOT JAEGERTRACING_BUILD_CROSSDOCK" ON)

+ 

+ if(JAEGERTRACING_WITH_YAML_CPP)

+-  hunter_add_package(yaml-cpp)

+-  # Not `${hunter_config}` because yaml-cpp provides its own

+-  # yaml-cpp-config.cmake file

+-  find_package(yaml-cpp CONFIG REQUIRED)

+-  if(HUNTER_ENABLED)

+-      list(APPEND LIBS yaml-cpp::yaml-cpp)

+-  else()

+-      list(APPEND LIBS yaml-cpp)

+-  endif()

+-  list(APPEND package_deps yaml-cpp)

++  # rely on yaml-cpp provided by OS vendor

++  list(APPEND LIBS yaml-cpp)

+ endif()

+ 

+ include(CTest)

diff --git a/contrib/src/jaeger-client-cpp/Makefile b/contrib/src/jaeger-client-cpp/Makefile
new file mode 100644
index 0000000..ecf94b8
--- /dev/null
+++ b/contrib/src/jaeger-client-cpp/Makefile
@@ -0,0 +1,28 @@
+# jaeger-client-cpp
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+JAEGER_CLIENT_CPP_URL := $(GITHUB)/jaegertracing/jaeger-client-cpp/archive/v$(JAEGER_CLIENT_CPP_VERSION).tar.gz
+
+PKGS += jaeger-client-cpp
+
+$(TARBALLS)/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz:
+	$(call download_pkg,$(JAEGER_CLIENT_CPP_URL),jaeger-client-cpp)
+
+.sum-jaeger-client-cpp: jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz
+
+jaeger-client-cpp: jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz .sum-jaeger-client-cpp
+	$(UNPACK)
+	$(APPLY) $(SRC)/jaeger-client-cpp/CMakeLists.txt.patch
+	$(MOVE)
+
+DEPS_jaeger-client-cpp = opentracing-cpp $(DEPS_opentracing-cpp)
+
+# note the https://github.com/google/myanmar-tools/issues/42
+.jaeger-client-cpp: jaeger-client-cpp
+	cd $< && \
+		mkdir -p .build && \
+		cd .build && \
+		CXXFLAGS="-Wno-error=deprecated-copy" OpenTracing_DIR=$(TOPSRC)/opentracing-cpp/.build cmake -DCMAKE_BUILD_TYPE=Release -DJAEGERTRACING_PLUGIN=ON -DHUNTER_CONFIGURATION_TYPES=Release -DOPENTRACING_INC=$(TOPSRC)/local/usr/local/include ../ && \
+		make $(_SMP_MFLAGS)
+	cd $< && install -s .build/libjaegertracing_plugin.so $(PREFIX)/
+	touch $@
diff --git a/contrib/src/jaeger-client-cpp/SHA512SUMS b/contrib/src/jaeger-client-cpp/SHA512SUMS
new file mode 100644
index 0000000..023f8c1
--- /dev/null
+++ b/contrib/src/jaeger-client-cpp/SHA512SUMS
@@ -0,0 +1 @@
+e2cd621a51f0e4d25ff67ddbe86f17f6ef976e36b99c489aebdd330616e641fd0e428d2301a394eaa8920d35619f2d6172c436e8b828f44bdbe39e290e1849f0  jaeger-client-cpp-0.6.0.tar.gz
diff --git a/contrib/src/jaeger-client-cpp/version b/contrib/src/jaeger-client-cpp/version
new file mode 100644
index 0000000..0d212b5
--- /dev/null
+++ b/contrib/src/jaeger-client-cpp/version
@@ -0,0 +1 @@
+JAEGER_CLIENT_CPP_VERSION := 0.6.0
diff --git a/contrib/src/lua-nginx-module/Makefile b/contrib/src/lua-nginx-module/Makefile
new file mode 100644
index 0000000..164e088
--- /dev/null
+++ b/contrib/src/lua-nginx-module/Makefile
@@ -0,0 +1,21 @@
+# lua-nginx-module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+LUA_NGINX_MODULE_URL := $(GITHUB)/openresty/lua-nginx-module/archive/v$(LUA_NGINX_MODULE_VERSION).tar.gz
+
+PKGS += lua-nginx-module
+
+$(TARBALLS)/lua-nginx-module-$(LUA_NGINX_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(LUA_NGINX_MODULE_URL),lua-nginx-module)
+
+.sum-lua-nginx-module: lua-nginx-module-$(LUA_NGINX_MODULE_VERSION).tar.gz
+
+lua-nginx-module: lua-nginx-module-$(LUA_NGINX_MODULE_VERSION).tar.gz .sum-lua-nginx-module
+	$(UNPACK)
+	$(APPLY) $(SRC)/lua-nginx-module/config.patch
+	$(MOVE)
+
+DEPS_lua-nginx-module = luajit2 $(DEPS_luajit2) ngx_devel_kit $(DEPS_ngx_devel_kit)
+
+.lua-nginx-module: lua-nginx-module
+	touch $@
diff --git a/contrib/src/lua-nginx-module/SHA512SUMS b/contrib/src/lua-nginx-module/SHA512SUMS
new file mode 100644
index 0000000..80c6d91
--- /dev/null
+++ b/contrib/src/lua-nginx-module/SHA512SUMS
@@ -0,0 +1 @@
+6b258bdcb45f99f9cec3df14fa6747704ab1f0005f8a2ccd4440f8ec477e3dcbf6026e1acffc9d5fecb79605248168a77bd2a26d67c98c7d5cc336f9474ef68c  lua-nginx-module-0.10.19.tar.gz
diff --git a/contrib/src/lua-nginx-module/config.patch b/contrib/src/lua-nginx-module/config.patch
new file mode 100644
index 0000000..2fc73f7
--- /dev/null
+++ b/contrib/src/lua-nginx-module/config.patch
@@ -0,0 +1,26 @@
+--- a/config	2015-12-20 05:43:48.000000000 +0000
++++ b/config	2015-12-25 08:01:04.138004474 +0000
+@@ -45,9 +45,9 @@
+         NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT"
+ 
+         if [ $NGX_RPATH = YES ]; then
+-            ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++            ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a -R$LUAJIT_LIB $luajit_ld_opt"
+         else
+-            ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++            ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a $ngx_lua_opt_L $luajit_ld_opt"
+         fi
+ 
+         . auto/feature
+@@ -71,9 +71,9 @@
+             NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT"
+ 
+             if [ $NGX_RPATH = YES ]; then
+-                ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++                ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a -R$LUAJIT_LIB $luajit_ld_opt"
+             else
+-                ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++                ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a $luajit_ld_opt"
+             fi
+ 
+             . auto/feature
diff --git a/contrib/src/lua-nginx-module/version b/contrib/src/lua-nginx-module/version
new file mode 100644
index 0000000..0b9a048
--- /dev/null
+++ b/contrib/src/lua-nginx-module/version
@@ -0,0 +1 @@
+LUA_NGINX_MODULE_VERSION := 0.10.19
diff --git a/contrib/src/lua-resty-core/Makefile b/contrib/src/lua-resty-core/Makefile
new file mode 100644
index 0000000..9fe8375
--- /dev/null
+++ b/contrib/src/lua-resty-core/Makefile
@@ -0,0 +1,18 @@
+# lua-resty-core
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+LUA_RESTY_CORE_URL := $(GITHUB)/openresty/lua-resty-core/archive/v$(LUA_RESTY_CORE_VERSION).tar.gz
+
+PKGS += lua-resty-core
+
+$(TARBALLS)/lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz:
+	$(call download_pkg,$(LUA_RESTY_CORE_URL),lua-resty-core)
+
+.sum-lua-resty-core: lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz
+
+lua-resty-core: lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz .sum-lua-resty-core
+	$(UNPACK)
+	$(MOVE)
+
+.lua-resty-core: lua-resty-core
+	touch $@
diff --git a/contrib/src/lua-resty-core/SHA512SUMS b/contrib/src/lua-resty-core/SHA512SUMS
new file mode 100644
index 0000000..67e1b69
--- /dev/null
+++ b/contrib/src/lua-resty-core/SHA512SUMS
@@ -0,0 +1 @@
+e34475fe3966493d010dd0e6e9d0073e6cd6e700ccf34048b6ac26af52206333b12500c755f29904fd5d792556d26d19f0ddfd3b61cd9f5e0dc608bef17051a5  lua-resty-core-0.1.21.tar.gz
diff --git a/contrib/src/lua-resty-core/version b/contrib/src/lua-resty-core/version
new file mode 100644
index 0000000..9878847
--- /dev/null
+++ b/contrib/src/lua-resty-core/version
@@ -0,0 +1 @@
+LUA_RESTY_CORE_VERSION := 0.1.21
diff --git a/contrib/src/lua-resty-lrucache/Makefile b/contrib/src/lua-resty-lrucache/Makefile
new file mode 100644
index 0000000..d6134ff
--- /dev/null
+++ b/contrib/src/lua-resty-lrucache/Makefile
@@ -0,0 +1,18 @@
+# lua-resty-lrucache
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+LUA_RESTY_LRUCACHE_URL := $(GITHUB)/openresty/lua-resty-lrucache/archive/v$(LUA_RESTY_LRUCACHE_VERSION).tar.gz
+
+PKGS += lua-resty-lrucache
+
+$(TARBALLS)/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz:
+	$(call download_pkg,$(LUA_RESTY_LRUCACHE_URL),lua-resty-lrucache)
+
+.sum-lua-resty-lrucache: lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz
+
+lua-resty-lrucache: lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz .sum-lua-resty-lrucache
+	$(UNPACK)
+	$(MOVE)
+
+.lua-resty-lrucache: lua-resty-lrucache
+	touch $@
diff --git a/contrib/src/lua-resty-lrucache/SHA512SUMS b/contrib/src/lua-resty-lrucache/SHA512SUMS
new file mode 100644
index 0000000..01d7e1a
--- /dev/null
+++ b/contrib/src/lua-resty-lrucache/SHA512SUMS
@@ -0,0 +1 @@
+619d52bded0c81913d285a5087e2544946f21e2cdddcf38a998230b023839ac158f329e46ec8f85b83f43076ee3237be25e0d2f872126064f45050d0dd7ec78e  lua-resty-lrucache-0.10.tar.gz
diff --git a/contrib/src/lua-resty-lrucache/version b/contrib/src/lua-resty-lrucache/version
new file mode 100644
index 0000000..0bd59ad
--- /dev/null
+++ b/contrib/src/lua-resty-lrucache/version
@@ -0,0 +1 @@
+LUA_RESTY_LRUCACHE_VERSION := 0.10
diff --git a/contrib/src/luajit2/Makefile b/contrib/src/luajit2/Makefile
new file mode 100644
index 0000000..8ca77dd
--- /dev/null
+++ b/contrib/src/luajit2/Makefile
@@ -0,0 +1,22 @@
+# LuaJIT2
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+LUAJIT2_URL := $(GITHUB)/openresty/luajit2/archive/v$(LUAJIT2_VERSION).tar.gz
+
+PKGS += luajit2
+
+$(TARBALLS)/luajit2-$(LUAJIT2_VERSION).tar.gz:
+	$(call download_pkg,$(LUAJIT2_URL),luajit2)
+
+.sum-luajit2: luajit2-$(LUAJIT2_VERSION).tar.gz
+
+luajit2: luajit2-$(LUAJIT2_VERSION).tar.gz .sum-luajit2
+	$(UNPACK)
+	$(APPLY) $(SRC)/luajit2/Makefile.patch
+	$(APPLY) $(SRC)/luajit2/src-luaconf.h.patch
+	$(MOVE)
+
+.luajit2: luajit2
+	cd $< && DESTDIR=$(PREFIX) CFLAGS="-fPIC" $(MAKE) install
+	mv $(PREFIX)/usr/bin/luajit $(PREFIX)/usr/bin/nginx-luajit
+	touch $@
diff --git a/contrib/src/luajit2/Makefile.patch b/contrib/src/luajit2/Makefile.patch
new file mode 100644
index 0000000..79c6033
--- /dev/null
+++ b/contrib/src/luajit2/Makefile.patch
@@ -0,0 +1,23 @@
+--- a/Makefile	2017-09-14 14:20:50.000000000 +0300
++++ b/Makefile	2017-09-14 14:22:39.000000000 +0300
+@@ -25,7 +25,7 @@
+ # Change the installation path as needed. This automatically adjusts
+ # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
+ #
+-export PREFIX= /usr/local
++export PREFIX= /usr
+ export MULTILIB= lib
+ ##############################################################################
+ 
+@@ -33,9 +33,9 @@
+ INSTALL_BIN=   $(DPREFIX)/bin
+ INSTALL_LIB=   $(DPREFIX)/$(MULTILIB)
+ INSTALL_SHARE= $(DPREFIX)/share
+-INSTALL_INC=   $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
++INSTALL_INC=   $(DPREFIX)/include/nginx-luajit-$(MAJVER).$(MINVER)
+ 
+-INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION)
++INSTALL_LJLIBD= $(INSTALL_SHARE)/nginx-luajit-2.1
+ INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
+ INSTALL_LMODD= $(INSTALL_SHARE)/lua
+ INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
diff --git a/contrib/src/luajit2/SHA512SUMS b/contrib/src/luajit2/SHA512SUMS
new file mode 100644
index 0000000..3e1fdfa
--- /dev/null
+++ b/contrib/src/luajit2/SHA512SUMS
@@ -0,0 +1 @@
+808a2564d02a261a9e4c94af5ba8051a1ea271f4187f46ca58b9894d0f69e42040d603d6d1caa03812a1db092684010498601e4d33a95d3e7955497e29f48a06  luajit2-2.1-20201027.tar.gz
diff --git a/contrib/src/luajit2/src-luaconf.h.patch b/contrib/src/luajit2/src-luaconf.h.patch
new file mode 100644
index 0000000..02783dd
--- /dev/null
+++ b/contrib/src/luajit2/src-luaconf.h.patch
@@ -0,0 +1,11 @@
+--- a/src/luaconf.h	2017-09-14 14:24:29.000000000 +0300
++++ b/src/luaconf.h	2017-09-14 14:25:08.000000000 +0300
+@@ -37,7 +37,7 @@
+ #endif
+ #define LUA_LROOT	"/usr/local"
+ #define LUA_LUADIR	"/lua/5.1/"
+-#define LUA_LJDIR	"/luajit-2.1.0-beta3/"
++#define LUA_LJDIR	"/nginx-luajit-2.1/"
+ 
+ #ifdef LUA_ROOT
+ #define LUA_JROOT	LUA_ROOT
diff --git a/contrib/src/luajit2/version b/contrib/src/luajit2/version
new file mode 100644
index 0000000..0f46d87
--- /dev/null
+++ b/contrib/src/luajit2/version
@@ -0,0 +1 @@
+LUAJIT2_VERSION := 2.1-20201027
diff --git a/contrib/src/modsecurity-nginx/Makefile b/contrib/src/modsecurity-nginx/Makefile
new file mode 100644
index 0000000..ac768a5
--- /dev/null
+++ b/contrib/src/modsecurity-nginx/Makefile
@@ -0,0 +1,23 @@
+# ModSecurity-nginx
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+MODSECURITY_NGINX_GITURL := $(GITHUB)/SpiderLabs/ModSecurity-nginx.git
+
+PKGS += modsecurity-nginx
+
+$(TARBALLS)/modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz:
+	$(call download_git,$(MODSECURITY_NGINX_GITURL),,$(MODSECURITY_NGINX_GITHASH))
+
+.sum-modsecurity-nginx: modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz
+	$(call check_githash,$(MODSECURITY_NGINX_GITHASH))
+	touch $@
+
+modsecurity-nginx: modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz .sum-modsecurity-nginx
+	$(UNPACK)
+	$(APPLY) $(SRC)/modsecurity-nginx/PR165.patch
+	$(MOVE)
+
+DEPS_modsecurity-nginx = modsecurity $(DEPS_modsecurity)
+
+.modsecurity-nginx: modsecurity-nginx
+	touch $@
diff --git a/contrib/src/modsecurity-nginx/PR165.patch b/contrib/src/modsecurity-nginx/PR165.patch
new file mode 100644
index 0000000..d0505e7
--- /dev/null
+++ b/contrib/src/modsecurity-nginx/PR165.patch
@@ -0,0 +1,73 @@
+From d8987f6476edd2ac9d5df99778f9e12cfbe8e83e Mon Sep 17 00:00:00 2001
+From: Andrei Belov <defanator@gmail.com>
+Date: Tue, 6 Aug 2019 16:32:15 +0300
+Subject: [PATCH] Avoid processing of subrequests initiated by the error_page
+
+Closes #164, SpiderLabs/ModSecurity#2143.
+---
+ src/ngx_http_modsecurity_header_filter.c | 4 ++++
+ src/ngx_http_modsecurity_log.c           | 4 ++++
+ src/ngx_http_modsecurity_pre_access.c    | 4 ++++
+ src/ngx_http_modsecurity_rewrite.c       | 4 ++++
+ 4 files changed, 16 insertions(+)
+
+diff --git a/src/ngx_http_modsecurity_header_filter.c b/src/ngx_http_modsecurity_header_filter.c
+index 3f9f748..04ad7ac 100644
+--- a/src/ngx_http_modsecurity_header_filter.c
++++ b/src/ngx_http_modsecurity_header_filter.c
+@@ -420,6 +420,10 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
+ 
+ /* XXX: if NOT_MODIFIED, do we need to process it at all?  see xslt_header_filter() */
+ 
++    if (r->error_page) {
++        return ngx_http_next_header_filter(r);
++    }
++
+     ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
+ 
+     dd("header filter, recovering ctx: %p", ctx);
+diff --git a/src/ngx_http_modsecurity_log.c b/src/ngx_http_modsecurity_log.c
+index 5546596..39cf6b7 100644
+--- a/src/ngx_http_modsecurity_log.c
++++ b/src/ngx_http_modsecurity_log.c
+@@ -41,6 +41,10 @@ ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
+     ngx_http_modsecurity_ctx_t   *ctx;
+     ngx_http_modsecurity_conf_t  *mcf;
+ 
++    if (r->error_page) {
++        return NGX_OK;
++    }
++
+     dd("catching a new _log_ phase handler");
+ 
+     mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
+diff --git a/src/ngx_http_modsecurity_pre_access.c b/src/ngx_http_modsecurity_pre_access.c
+index 05d7140..d5389ad 100644
+--- a/src/ngx_http_modsecurity_pre_access.c
++++ b/src/ngx_http_modsecurity_pre_access.c
+@@ -48,6 +48,10 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
+     ngx_http_modsecurity_ctx_t   *ctx;
+     ngx_http_modsecurity_conf_t  *mcf;
+ 
++    if (r->error_page) {
++        return NGX_DECLINED;
++    }
++
+     dd("catching a new _preaccess_ phase handler");
+ 
+     mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
+diff --git a/src/ngx_http_modsecurity_rewrite.c b/src/ngx_http_modsecurity_rewrite.c
+index cd02438..fa178a2 100644
+--- a/src/ngx_http_modsecurity_rewrite.c
++++ b/src/ngx_http_modsecurity_rewrite.c
+@@ -27,6 +27,10 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
+     ngx_http_modsecurity_ctx_t   *ctx;
+     ngx_http_modsecurity_conf_t  *mcf;
+ 
++    if (r->error_page) {
++        return NGX_DECLINED;
++    }
++
+     mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
+     if (mcf == NULL || mcf->enable != 1) {
+         dd("ModSecurity not enabled... returning");
diff --git a/contrib/src/modsecurity-nginx/version b/contrib/src/modsecurity-nginx/version
new file mode 100644
index 0000000..7555ca6
--- /dev/null
+++ b/contrib/src/modsecurity-nginx/version
@@ -0,0 +1,2 @@
+MODSECURITY_NGINX_VERSION := 1.0.1
+MODSECURITY_NGINX_GITHASH := e50e43ee4cc87565922ed98b1b6c72751019c326
diff --git a/contrib/src/modsecurity/Makefile b/contrib/src/modsecurity/Makefile
new file mode 100644
index 0000000..0950753
--- /dev/null
+++ b/contrib/src/modsecurity/Makefile
@@ -0,0 +1,32 @@
+# ModSecurity
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+
+# The release tarball distributed from GitHub does not include
+# all the required submodules (libinjection in particular), so
+# we are building our own tarball by running build.sh + configure +
+# make dist from desired version tag.
+#
+# MODSECURITY_URL := $(GITHUB)/SpiderLabs/ModSecurity/archive/v$(MODSECURITY_VERSION).tar.gz
+MODSECURITY_URL := $(CONTRIB_NGINX)/modsecurity/modsecurity-v$(MODSECURITY_VERSION).tar.gz
+
+PKGS += modsecurity
+
+$(TARBALLS)/modsecurity-v$(MODSECURITY_VERSION).tar.gz:
+	$(call download_pkg,$(MODSECURITY_URL),modsecurity)
+
+.sum-modsecurity: modsecurity-v$(MODSECURITY_VERSION).tar.gz
+
+modsecurity: modsecurity-v$(MODSECURITY_VERSION).tar.gz .sum-modsecurity
+	$(UNPACK)
+	$(APPLY) $(SRC)/modsecurity/PR2348.patch
+	$(MOVE)
+
+.modsecurity: modsecurity
+	cd $< && \
+		./configure --prefix $(PREFIX) --without-lmdb --without-lua && \
+		make $(_SMP_MFLAGS) install && \
+		TERM=foo make check-TESTS
+	rm -f /tmp/audit_test.log /tmp/audit_test_parallel.log
+	rm -rf /tmp/test
+	touch $@
diff --git a/contrib/src/modsecurity/PR2348.patch b/contrib/src/modsecurity/PR2348.patch
new file mode 100644
index 0000000..41e7a56
--- /dev/null
+++ b/contrib/src/modsecurity/PR2348.patch
@@ -0,0 +1,280 @@
+diff --git a/src/operators/rx.cc b/src/operators/rx.cc
+index 0ba983d73..b4fc6ff4d 100644
+--- a/src/operators/rx.cc
++++ b/src/operators/rx.cc
+@@ -38,7 +38,6 @@
+ 
+ bool Rx::evaluate(Transaction *transaction, Rule *rule,
+     const std::string& input, std::shared_ptr<RuleMessage> ruleMessage) {
+-    std::list<SMatch> matches;
+     Regex *re;
+ 
+     if (m_param.empty() && !m_string->m_containsMacro) {
+@@ -52,29 +51,29 @@
+         re = m_re;
+     }
+ 
+-    matches = re->searchAll(input);
++    std::vector<Utils::SMatchCapture> captures;
++    re->searchOneMatch(input, captures);
++
+     if (rule && rule->m_containsCaptureAction && transaction) {
+-        int i = 0;
+-        matches.reverse();
+-        for (const SMatch& a : matches) {
++        for (const Utils::SMatchCapture& capture : captures) {
++            const std::string capture_substring(input.substr(capture.m_offset,capture.m_length));
+             transaction->m_collections.m_tx_collection->storeOrUpdateFirst(
+-                std::to_string(i), a.str());
++                std::to_string(capture.m_group), capture_substring);
+             ms_dbg_a(transaction, 7, "Added regex subexpression TX." +
+-                std::to_string(i) + ": " + a.str());
+-            transaction->m_matched.push_back(a.str());
+-            i++;
++                std::to_string(capture.m_group) + ": " + capture_substring);
++            transaction->m_matched.push_back(capture_substring);
+         }
+     }
+ 
+-    for (const auto & i : matches) {
+-        logOffset(ruleMessage, i.offset(), i.str().size());
++    for (const auto & capture : captures) {
++        logOffset(ruleMessage, capture.m_offset, capture.m_length);
+     }
+ 
+     if (m_string->m_containsMacro) {
+         delete re;
+     }
+ 
+-    if (matches.size() > 0) {
++    if (captures.size() > 0) {
+         return true;
+     }
+ 
+diff --git a/src/utils/regex.cc b/src/utils/regex.cc
+index be56e378a..0feb256cc 100644
+--- a/src/utils/regex.cc
++++ b/src/utils/regex.cc
+@@ -16,10 +16,6 @@
+ #include "src/utils/regex.h"
+ 
+ #include <pcre.h>
+-#include <sys/socket.h>
+-#include <sys/types.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+ #include <string>
+ #include <list>
+ 
+@@ -99,6 +95,26 @@ std::list<SMatch> Regex::searchAll(const std::string& s) const {
+     return retList;
+ }
+ 
++bool Regex::searchOneMatch(const std::string& s, std::vector<SMatchCapture>& captures) const {
++    const char *subject = s.c_str();
++    int ovector[OVECCOUNT];
++
++    int rc = pcre_exec(m_pc, m_pce, subject, s.size(), 0, 0, ovector, OVECCOUNT);
++
++    for (int i = 0; i < rc; i++) {
++        size_t start = ovector[2*i];
++        size_t end = ovector[2*i+1];
++        size_t len = end - start;
++        if (end > s.size()) {
++            continue;
++        }
++        SMatchCapture capture(i, start, len);
++        captures.push_back(capture);
++    }
++
++    return (rc > 0);
++}
++
+ int Regex::search(const std::string& s, SMatch *match) const {
+     int ovector[OVECCOUNT];
+     int ret = pcre_exec(m_pc, m_pce, s.c_str(),
+diff --git a/src/utils/regex.h b/src/utils/regex.h
+index 7dcc4dbf6..46dab6b83 100644
+--- a/src/utils/regex.h
++++ b/src/utils/regex.h
+@@ -19,6 +19,7 @@
+ #include <fstream>
+ #include <string>
+ #include <list>
++#include <vector>
+ 
+ #ifndef SRC_UTILS_REGEX_H_
+ #define SRC_UTILS_REGEX_H_
+@@ -47,6 +48,16 @@
+     size_t m_offset;
+ };
+ 
++struct SMatchCapture {
++    SMatchCapture(size_t group, size_t offset, size_t length) :
++	m_group(group),
++	m_offset(offset),
++	m_length(length) { }
++
++    size_t m_group; // E.g. 0 = full match; 6 = capture group 6
++    size_t m_offset; // offset of match within the analyzed string
++    size_t m_length;
++};
+ 
+ class Regex {
+  public:
+@@ -58,6 +69,7 @@
+     Regex& operator=(const Regex&) = delete;
+ 
+     std::list<SMatch> searchAll(const std::string& s) const;
++    bool searchOneMatch(const std::string& s, std::vector<SMatchCapture>& captures) const;
+     int search(const std::string &s, SMatch *m) const;
+     int search(const std::string &s) const;
+
+diff --git a/test/test-cases/regression/variable-TX.json b/test/test-cases/regression/variable-TX.json
+index 0cd45381b..904628e9b 100644
+--- a/test/test-cases/regression/variable-TX.json
++++ b/test/test-cases/regression/variable-TX.json
+@@ -80,5 +80,143 @@
+       "SecRule REQUEST_HEADERS \"@rx ([A-z]+)\" \"id:1,log,pass,capture,id:14\"",
+       "SecRule TX:0 \"@rx ([A-z]+)\" \"id:15\""
+     ]
++  },
++  {
++    "enabled":1,
++    "version_min":300000,
++    "title":"Testing Variables :: capture group match after unused group",
++    "client":{
++      "ip":"200.249.12.31",
++      "port":123
++    },
++    "server":{
++      "ip":"200.249.12.31",
++      "port":80
++    },
++    "request":{
++      "uri":"/?key=aadd",
++      "method":"GET"
++    },
++    "response":{
++      "headers":{
++        "Date":"Mon, 13 Jul 2015 20:02:41 GMT",
++        "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
++        "Content-Type":"text/html"
++      },
++      "body":[
++        "no need."
++      ]
++    },
++    "expected":{
++      "debug_log":"Added regex subexpression TX\\.3: dd[\\s\\S]*Target value: \"dd\" \\(Variable\\: TX\\:3[\\s\\S]*Rule returned 1"
++    },
++    "rules":[
++      "SecRuleEngine On",
++      "SecRule ARGS \"@rx (aa)(bb|cc)?(dd)\" \"id:1,log,pass,capture,id:16\"",
++      "SecRule TX:3 \"@streq dd\" \"id:19,phase:2,log,pass\""
++    ]
++  },
++  {
++    "enabled":1,
++    "version_min":300000,
++    "title":"Testing Variables :: empty capture group match followed by nonempty capture group",
++    "client":{
++      "ip":"200.249.12.31",
++      "port":123
++    },
++    "server":{
++      "ip":"200.249.12.31",
++      "port":80
++    },
++    "request":{
++      "uri":"/?key=aadd",
++      "method":"GET"
++    },
++    "response":{
++      "headers":{
++        "Date":"Mon, 13 Jul 2015 20:02:41 GMT",
++        "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
++        "Content-Type":"text/html"
++      },
++      "body":[
++        "no need."
++      ]
++    },
++    "expected":{
++      "debug_log":"Added regex subexpression TX\\.3: dd[\\s\\S]*Target value: \"dd\" \\(Variable\\: TX\\:3[\\s\\S]*Rule returned 1"
++    },
++    "rules":[
++      "SecRuleEngine On",
++      "SecRule ARGS \"@rx (aa)(bb|cc|)(dd)\" \"id:18,phase:1,log,pass,capture\"",
++      "SecRule TX:3 \"@streq dd\" \"id:19,phase:2,log,pass\""
++    ]
++  },
++  {
++    "enabled":1,
++    "version_min":300000,
++    "title":"Testing Variables :: repeating capture group -- alternates",
++    "client":{
++      "ip":"200.249.12.31",
++      "port":123
++    },
++    "server":{
++      "ip":"200.249.12.31",
++      "port":80
++    },
++    "request":{
++      "uri":"/?key=_abc123_",
++      "method":"GET"
++    },
++    "response":{
++      "headers":{
++        "Date":"Mon, 13 Jul 2015 20:02:41 GMT",
++        "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
++        "Content-Type":"text/html"
++      },
++      "body":[
++        "no need."
++      ]
++    },
++    "expected":{
++      "debug_log":"Added regex subexpression TX\\.2: abc[\\s\\S]*Added regex subexpression TX\\.3: 123"
++    },
++    "rules":[
++      "SecRuleEngine On",
++      "SecRule ARGS \"@rx _((?:(abc)|(123))+)_\" \"id:18,phase:1,log,pass,capture\""
++    ]
++  },
++  {
++    "enabled":1,
++    "version_min":300000,
++    "title":"Testing Variables :: repeating capture group -- same (nested)",
++    "client":{
++      "ip":"200.249.12.31",
++      "port":123
++    },
++    "server":{
++      "ip":"200.249.12.31",
++      "port":80
++    },
++    "request":{
++      "uri":"/?key=a:5a:8a:9",
++      "method":"GET"
++    },
++    "response":{
++      "headers":{
++        "Date":"Mon, 13 Jul 2015 20:02:41 GMT",
++        "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
++        "Content-Type":"text/html"
++      },
++      "body":[
++        "no need."
++      ]
++    },
++    "expected":{
++      "debug_log":"Added regex subexpression TX\\.1: 5[\\s\\S]*Added regex subexpression TX\\.2: 8[\\s\\S]*Added regex subexpression TX\\.3: 9"
++    },
++    "rules":[
++      "SecRuleEngine On",
++      "SecRule ARGS \"@rx a:([0-9])(?:a:([0-9])(?:a:([0-9]))*)*\" \"id:18,phase:1,log,pass,capture\""
++    ]
+   }
+ ]
diff --git a/contrib/src/modsecurity/SHA512SUMS b/contrib/src/modsecurity/SHA512SUMS
new file mode 100644
index 0000000..8f9ec47
--- /dev/null
+++ b/contrib/src/modsecurity/SHA512SUMS
@@ -0,0 +1 @@
+6ba9265054acfe7e67583dd0100bb592687080eee5d8cd5371785bb7b615a7361b52d0a037f6fa4e90ecfe857ed6a714969301b0bf17a638efebba86532f3f85  modsecurity-v3.0.4.tar.gz
diff --git a/contrib/src/modsecurity/version b/contrib/src/modsecurity/version
new file mode 100644
index 0000000..de8a971
--- /dev/null
+++ b/contrib/src/modsecurity/version
@@ -0,0 +1 @@
+MODSECURITY_VERSION := 3.0.4
diff --git a/contrib/src/nginx-opentracing/Makefile b/contrib/src/nginx-opentracing/Makefile
new file mode 100644
index 0000000..8cf13a0
--- /dev/null
+++ b/contrib/src/nginx-opentracing/Makefile
@@ -0,0 +1,20 @@
+# nginx-opentracing
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+NGINX_OPENTRACING_URL := $(GITHUB)/opentracing-contrib/nginx-opentracing/archive/v$(NGINX_OPENTRACING_VERSION).tar.gz
+
+PKGS += nginx-opentracing
+
+$(TARBALLS)/nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz:
+	$(call download_pkg,$(NGINX_OPENTRACING_URL),nginx-opentracing)
+
+.sum-nginx-opentracing: nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz
+
+nginx-opentracing: nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz .sum-nginx-opentracing
+	$(UNPACK)
+	$(MOVE)
+
+DEPS_nginx-opentracing = opentracing-cpp $(DEPS_opentracing-cpp)
+
+.nginx-opentracing: nginx-opentracing
+	touch $@
diff --git a/contrib/src/nginx-opentracing/SHA512SUMS b/contrib/src/nginx-opentracing/SHA512SUMS
new file mode 100644
index 0000000..0971808
--- /dev/null
+++ b/contrib/src/nginx-opentracing/SHA512SUMS
@@ -0,0 +1 @@
+1700484555892e62c1dae846cd6b736ed084cdac6ee1cfd4f903644c4119de227ec8682ff5b2590c9b53524ab4305de3267f419a68226f33f9b3ef8128028dbf  nginx-opentracing-0.10.0.tar.gz
diff --git a/contrib/src/nginx-opentracing/version b/contrib/src/nginx-opentracing/version
new file mode 100644
index 0000000..9d09f3e
--- /dev/null
+++ b/contrib/src/nginx-opentracing/version
@@ -0,0 +1 @@
+NGINX_OPENTRACING_VERSION := 0.10.0
diff --git a/contrib/src/nginx-rtmp-module/Makefile b/contrib/src/nginx-rtmp-module/Makefile
new file mode 100644
index 0000000..048f26a
--- /dev/null
+++ b/contrib/src/nginx-rtmp-module/Makefile
@@ -0,0 +1,19 @@
+# nginx-rtmp-module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+NGINX_RTMP_MODULE_URL := $(GITHUB)/arut/nginx-rtmp-module/archive/v$(NGINX_RTMP_MODULE_VERSION).tar.gz
+
+PKGS += nginx-rtmp-module
+
+$(TARBALLS)/nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(NGINX_RTMP_MODULE_URL),nginx-rtmp-module)
+
+.sum-nginx-rtmp-module: nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION).tar.gz
+
+nginx-rtmp-module: nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION).tar.gz .sum-nginx-rtmp-module
+	$(UNPACK)
+	$(APPLY) $(SRC)/nginx-rtmp-module/PR1340.patch
+	$(MOVE)
+
+.nginx-rtmp-module: nginx-rtmp-module
+	touch $@
diff --git a/contrib/src/nginx-rtmp-module/PR1340.patch b/contrib/src/nginx-rtmp-module/PR1340.patch
new file mode 100644
index 0000000..4315592
--- /dev/null
+++ b/contrib/src/nginx-rtmp-module/PR1340.patch
@@ -0,0 +1,21 @@
+From 28f0acce2ebcd20f236e2d804a2ebef77b0f5640 Mon Sep 17 00:00:00 2001
+From: Andrei Belov <defanator@gmail.com>
+Date: Sat, 22 Dec 2018 02:39:31 +0300
+Subject: [PATCH] Fixed building with gcc 8
+
+---
+ ngx_rtmp_eval.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/ngx_rtmp_eval.c b/ngx_rtmp_eval.c
+index 1e5195a9..c658f14e 100644
+--- a/ngx_rtmp_eval.c
++++ b/ngx_rtmp_eval.c
+@@ -166,6 +166,7 @@ ngx_rtmp_eval(void *ctx, ngx_str_t *in, ngx_rtmp_eval_t **e, ngx_str_t *out,
+                         state = ESCAPE;
+                         continue;
+                 }
++                /* fall through */
+ 
+             case ESCAPE:
+                 ngx_rtmp_eval_append(&b, &c, 1, log);
diff --git a/contrib/src/nginx-rtmp-module/SHA512SUMS b/contrib/src/nginx-rtmp-module/SHA512SUMS
new file mode 100644
index 0000000..56f0f0e
--- /dev/null
+++ b/contrib/src/nginx-rtmp-module/SHA512SUMS
@@ -0,0 +1 @@
+4a0af5e9afa4deb0b53de8de7ddb2cfa6430d372e1ef9e421f01b509548bd134d427345442ac1ce667338cc2a1484dc2ab732e316e878ac7d3537dc527d5f922  nginx-rtmp-module-1.2.1.tar.gz
diff --git a/contrib/src/nginx-rtmp-module/version b/contrib/src/nginx-rtmp-module/version
new file mode 100644
index 0000000..e311d2d
--- /dev/null
+++ b/contrib/src/nginx-rtmp-module/version
@@ -0,0 +1 @@
+NGINX_RTMP_MODULE_VERSION := 1.2.1
diff --git a/contrib/src/nginx/Makefile b/contrib/src/nginx/Makefile
new file mode 100644
index 0000000..bcaf27e
--- /dev/null
+++ b/contrib/src/nginx/Makefile
@@ -0,0 +1,44 @@
+# nginx
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+NGINX_URL := $(NGINX)/nginx-$(NGINX_VERSION).tar.gz
+
+PKGS += nginx
+
+$(TARBALLS)/nginx-$(NGINX_VERSION).tar.gz:
+	$(call download_pkg,$(NGINX_URL),nginx)
+
+.sum-nginx: nginx-$(NGINX_VERSION).tar.gz
+
+nginx: nginx-$(NGINX_VERSION).tar.gz .sum-nginx
+	$(UNPACK)
+	$(MOVE)
+
+.nginx: nginx
+	cd $< && ./configure \
+		--prefix=$(PREFIX) \
+		--with-compat \
+		--with-threads \
+		--with-http_addition_module \
+		--with-http_auth_request_module \
+		--with-http_dav_module \
+		--with-http_flv_module \
+		--with-http_gunzip_module \
+		--with-http_gzip_static_module \
+		--with-http_mp4_module \
+		--with-http_random_index_module \
+		--with-http_realip_module \
+		--with-http_secure_link_module \
+		--with-http_slice_module \
+		--with-http_ssl_module \
+		--with-http_stub_status_module \
+		--with-http_sub_module \
+		--with-http_v2_module \
+		--with-mail \
+		--with-mail_ssl_module \
+		--with-stream \
+		--with-stream_realip_module \
+		--with-stream_ssl_module \
+		--with-stream_ssl_preread_module
+	cd $< && $(MAKE) $(_SMP_MFLAGS) install
+	touch $@
diff --git a/contrib/src/nginx/SHA512SUMS b/contrib/src/nginx/SHA512SUMS
new file mode 100644
index 0000000..1f4efe0
--- /dev/null
+++ b/contrib/src/nginx/SHA512SUMS
@@ -0,0 +1 @@
+1249c56b124a8de71f5d722e53d599f3b0cb14dc0f95b1eb905a6a8019b2d33f8e76874de2a88d49c4c82ee4fa7aabd42e5044a0a110892c23b50f71cb632148  nginx-1.19.6.tar.gz
diff --git a/contrib/src/nginx/version b/contrib/src/nginx/version
new file mode 100644
index 0000000..3268628
--- /dev/null
+++ b/contrib/src/nginx/version
@@ -0,0 +1 @@
+NGINX_VERSION := 1.19.6
diff --git a/contrib/src/ngx_brotli/Makefile b/contrib/src/ngx_brotli/Makefile
new file mode 100644
index 0000000..f6dc1e4
--- /dev/null
+++ b/contrib/src/ngx_brotli/Makefile
@@ -0,0 +1,18 @@
+# ngx_brotli
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+NGX_BROTLI_URL := $(GITHUB)/google/ngx_brotli/archive/v$(NGX_BROTLI_VERSION)rc.tar.gz
+
+PKGS += ngx_brotli
+
+$(TARBALLS)/ngx_brotli-$(NGX_BROTLI_VERSION).tar.gz:
+	$(call download_pkg,$(NGX_BROTLI_URL),ngx_brotli)
+
+.sum-ngx_brotli: ngx_brotli-$(NGX_BROTLI_VERSION).tar.gz
+
+ngx_brotli: ngx_brotli-$(NGX_BROTLI_VERSION).tar.gz .sum-ngx_brotli
+	$(UNPACK)
+	$(MOVE)
+
+.ngx_brotli: ngx_brotli
+	touch $@
diff --git a/contrib/src/ngx_brotli/SHA512SUMS b/contrib/src/ngx_brotli/SHA512SUMS
new file mode 100644
index 0000000..aa01259
--- /dev/null
+++ b/contrib/src/ngx_brotli/SHA512SUMS
@@ -0,0 +1 @@
+05a880d5e48ac83be84498ed41fb4750211b827a9d7541acfd6ef494e5205a6e853d5594bfec3ab4ae668ea3f803e4f4b0ba550c76811971c8e266e42663c56d  ngx_brotli-1.0.0.tar.gz
diff --git a/contrib/src/ngx_brotli/version b/contrib/src/ngx_brotli/version
new file mode 100644
index 0000000..5bcecfc
--- /dev/null
+++ b/contrib/src/ngx_brotli/version
@@ -0,0 +1 @@
+NGX_BROTLI_VERSION := 1.0.0
diff --git a/contrib/src/ngx_devel_kit/Makefile b/contrib/src/ngx_devel_kit/Makefile
new file mode 100644
index 0000000..77bb36c
--- /dev/null
+++ b/contrib/src/ngx_devel_kit/Makefile
@@ -0,0 +1,18 @@
+# ngx_devel_kit
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+NGX_DEVEL_KIT_URL := $(GITHUB)/vision5/ngx_devel_kit/archive/v$(NGX_DEVEL_KIT_VERSION).tar.gz
+
+PKGS += ngx_devel_kit
+
+$(TARBALLS)/ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz:
+	$(call download_pkg,$(NGX_DEVEL_KIT_URL),ngx_devel_kit)
+
+.sum-ngx_devel_kit: ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz
+
+ngx_devel_kit: ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz .sum-ngx_devel_kit
+	$(UNPACK)
+	$(MOVE)
+
+.ngx_devel_kit: ngx_devel_kit
+	touch $@
diff --git a/contrib/src/ngx_devel_kit/SHA512SUMS b/contrib/src/ngx_devel_kit/SHA512SUMS
new file mode 100644
index 0000000..faf80d4
--- /dev/null
+++ b/contrib/src/ngx_devel_kit/SHA512SUMS
@@ -0,0 +1 @@
+de1e3349d8dd08e5982279b2219dc8a8006739f0409b8e0f5c50d93434beff1fbafba43e9c5ac85a5fab90afc5c0a7244a340610339c36f82f2cba7233e72de9  ngx_devel_kit-0.3.1.tar.gz
diff --git a/contrib/src/ngx_devel_kit/version b/contrib/src/ngx_devel_kit/version
new file mode 100644
index 0000000..94d8e14
--- /dev/null
+++ b/contrib/src/ngx_devel_kit/version
@@ -0,0 +1 @@
+NGX_DEVEL_KIT_VERSION := 0.3.1
diff --git a/contrib/src/ngx_http_geoip2_module/Makefile b/contrib/src/ngx_http_geoip2_module/Makefile
new file mode 100644
index 0000000..2810d2e
--- /dev/null
+++ b/contrib/src/ngx_http_geoip2_module/Makefile
@@ -0,0 +1,18 @@
+# ngx_http_geoip2_module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+GEOIP2_NGINX_MODULE_URL := $(GITHUB)/leev/ngx_http_geoip2_module/archive/$(GEOIP2_NGINX_MODULE_VERSION).tar.gz
+
+PKGS += ngx_http_geoip2_module
+
+$(TARBALLS)/ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(GEOIP2_NGINX_MODULE_URL),ngx_http_geoip2_module)
+
+.sum-ngx_http_geoip2_module: ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION).tar.gz
+
+ngx_http_geoip2_module: ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION).tar.gz .sum-ngx_http_geoip2_module
+	$(UNPACK)
+	$(MOVE)
+
+.ngx_http_geoip2_module: ngx_http_geoip2_module
+	touch $@
diff --git a/contrib/src/ngx_http_geoip2_module/SHA512SUMS b/contrib/src/ngx_http_geoip2_module/SHA512SUMS
new file mode 100644
index 0000000..ec84b01
--- /dev/null
+++ b/contrib/src/ngx_http_geoip2_module/SHA512SUMS
@@ -0,0 +1 @@
+06963b598c54e22d75ce837fb222f5aa6c9494c29e558ff46f1205d7159fc305414bfac4ed3288c836dcbf7628d92f26458e1992d34fc2f4b73275a32847bdc0  ngx_http_geoip2_module-3.3.tar.gz
diff --git a/contrib/src/ngx_http_geoip2_module/version b/contrib/src/ngx_http_geoip2_module/version
new file mode 100644
index 0000000..2be1719
--- /dev/null
+++ b/contrib/src/ngx_http_geoip2_module/version
@@ -0,0 +1 @@
+GEOIP2_NGINX_MODULE_VERSION := 3.3
diff --git a/contrib/src/ngx_http_substitutions_filter_module/Makefile b/contrib/src/ngx_http_substitutions_filter_module/Makefile
new file mode 100644
index 0000000..e6df0a0
--- /dev/null
+++ b/contrib/src/ngx_http_substitutions_filter_module/Makefile
@@ -0,0 +1,20 @@
+# ngx_http_substitutions_filter_module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+SUBSTITUTIONS_FILTER_NGINX_MODULE_GITURL := $(GITHUB)/yaoweibin/ngx_http_substitutions_filter_module.git
+
+PKGS += ngx_http_substitutions_filter_module
+
+$(TARBALLS)/ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH).tar.xz:
+	$(call download_git,$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITURL),,$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH))
+
+.sum-ngx_http_substitutions_filter_module: ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH).tar.xz
+	$(call check_githash,$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH))
+	touch $@
+
+ngx_http_substitutions_filter_module: ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH).tar.xz .sum-ngx_http_substitutions_filter_module
+	$(UNPACK)
+	$(MOVE)
+
+.ngx_http_substitutions_filter_module: ngx_http_substitutions_filter_module
+	touch $@
diff --git a/contrib/src/ngx_http_substitutions_filter_module/version b/contrib/src/ngx_http_substitutions_filter_module/version
new file mode 100644
index 0000000..e809e30
--- /dev/null
+++ b/contrib/src/ngx_http_substitutions_filter_module/version
@@ -0,0 +1,2 @@
+SUBSTITUTIONS_FILTER_NGINX_MODULE_VERSION := 0.6.4
+SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH := b8a71eacc7f986ba091282ab8b1bbbc6ae1807e0
diff --git a/contrib/src/njs/Makefile b/contrib/src/njs/Makefile
new file mode 100644
index 0000000..1d6675e
--- /dev/null
+++ b/contrib/src/njs/Makefile
@@ -0,0 +1,19 @@
+# njs
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+NJS_URL := https://hg.nginx.org/njs/archive/$(NJS_VERSION).tar.gz
+
+PKGS += njs
+
+$(TARBALLS)/njs-$(NJS_VERSION).tar.gz:
+	$(call download_pkg,$(NJS_URL),njs)
+
+.sum-njs: njs-$(NJS_VERSION).tar.gz
+
+njs: njs-$(NJS_VERSION).tar.gz .sum-njs
+	$(UNPACK)
+	$(MOVE)
+
+.njs: njs
+	cd $< && ./configure && $(MAKE) njs
+	touch $@
diff --git a/contrib/src/njs/SHA512SUMS b/contrib/src/njs/SHA512SUMS
new file mode 100644
index 0000000..bad4017
--- /dev/null
+++ b/contrib/src/njs/SHA512SUMS
@@ -0,0 +1 @@
+f90e894ae477bfb0fe28f24ce26f64d83749832ca45e5b3ac61d6df2c25f1a330842f13bf801cf08875c6c3006332afe3ec66d72d234dc26e5f527fb17f96370  njs-0.5.0.tar.gz
diff --git a/contrib/src/njs/version b/contrib/src/njs/version
new file mode 100644
index 0000000..a71ebd0
--- /dev/null
+++ b/contrib/src/njs/version
@@ -0,0 +1 @@
+NJS_VERSION := 0.5.0
diff --git a/contrib/src/opentracing-cpp/CMakeLists.txt.patch b/contrib/src/opentracing-cpp/CMakeLists.txt.patch
new file mode 100644
index 0000000..9a392e5
--- /dev/null
+++ b/contrib/src/opentracing-cpp/CMakeLists.txt.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt	2019-09-18 21:59:25.000000000 +0000
++++ b/CMakeLists.txt	2020-12-10 14:14:05.462435162 +0000
+@@ -180,7 +180,7 @@
+   target_link_libraries(opentracing-static ${LIBRARIES})
+   # Windows generates a lib and dll files for a shared library. using the same name will override the lib file generated by the shared target
+   if (NOT WIN32)
+-    set_target_properties(opentracing-static PROPERTIES OUTPUT_NAME opentracing)
++    set_target_properties(opentracing-static PROPERTIES OUTPUT_NAME opentracing POSITION_INDEPENDENT_CODE ON)
+   endif()
+   target_compile_definitions(opentracing-static PUBLIC OPENTRACING_STATIC)
+   target_include_directories(opentracing-static INTERFACE "$<INSTALL_INTERFACE:include/>")
diff --git a/contrib/src/opentracing-cpp/Makefile b/contrib/src/opentracing-cpp/Makefile
new file mode 100644
index 0000000..536c4d8
--- /dev/null
+++ b/contrib/src/opentracing-cpp/Makefile
@@ -0,0 +1,24 @@
+# opentracing-cpp
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+OPENTRACING_CPP_URL := $(GITHUB)/opentracing/opentracing-cpp/archive/v$(OPENTRACING_CPP_VERSION).tar.gz
+
+PKGS += opentracing-cpp
+
+$(TARBALLS)/opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz:
+	$(call download_pkg,$(OPENTRACING_CPP_URL),opentracing-cpp)
+
+.sum-opentracing-cpp: opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz
+
+opentracing-cpp: opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz .sum-opentracing-cpp
+	$(UNPACK)
+	$(APPLY) $(SRC)/opentracing-cpp/CMakeLists.txt.patch
+	$(MOVE)
+
+.opentracing-cpp: opentracing-cpp
+	cd $< && \
+		mkdir .build && \
+		cd .build && \
+		cmake ../ && \
+		DESTDIR=$(PREFIX) make $(_SMP_MFLAGS) install
+	touch $@
diff --git a/contrib/src/opentracing-cpp/SHA512SUMS b/contrib/src/opentracing-cpp/SHA512SUMS
new file mode 100644
index 0000000..359ceba
--- /dev/null
+++ b/contrib/src/opentracing-cpp/SHA512SUMS
@@ -0,0 +1 @@
+e4efad670d5f09e7ce2e1cd4820c7efdd12d8ffbc2f9cbeb54427f640922aa547e12cf01ae0066f5b89304c7f592ab2c2612139bf3275b19773028f1d8c159b5  opentracing-cpp-1.6.0.tar.gz
diff --git a/contrib/src/opentracing-cpp/version b/contrib/src/opentracing-cpp/version
new file mode 100644
index 0000000..379967a
--- /dev/null
+++ b/contrib/src/opentracing-cpp/version
@@ -0,0 +1 @@
+OPENTRACING_CPP_VERSION := 1.6.0
diff --git a/contrib/src/passenger/Makefile b/contrib/src/passenger/Makefile
new file mode 100644
index 0000000..60f84a1
--- /dev/null
+++ b/contrib/src/passenger/Makefile
@@ -0,0 +1,20 @@
+# passenger
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+PASSENGER_URL := http://s3.amazonaws.com/phusion-passenger/releases/passenger-$(PASSENGER_VERSION).tar.gz
+
+PKGS += passenger
+
+$(TARBALLS)/passenger-$(PASSENGER_VERSION).tar.gz:
+	$(call download_pkg,$(PASSENGER_URL),passenger)
+
+.sum-passenger: passenger-$(PASSENGER_VERSION).tar.gz
+
+passenger: passenger-$(PASSENGER_VERSION).tar.gz .sum-passenger
+	$(UNPACK)
+	$(APPLY) $(SRC)/passenger/build-nginx.rb.patch
+	$(APPLY) $(SRC)/passenger/src-nginx_module-ContentHandler.c.patch
+	$(MOVE)
+
+.passenger: passenger
+	touch $@
diff --git a/contrib/src/passenger/SHA512SUMS b/contrib/src/passenger/SHA512SUMS
new file mode 100644
index 0000000..9146f76
--- /dev/null
+++ b/contrib/src/passenger/SHA512SUMS
@@ -0,0 +1 @@
+57a013dbbddab13862c2d5445d048aafdc5a56297c56d3d642a39fe7757d3bcbd7e9e21aca36ebeb0f54a03d26e0886031a947cb098026a516900cc5bff42f0c  passenger-6.0.6.tar.gz
diff --git a/contrib/src/passenger/build-nginx.rb.patch b/contrib/src/passenger/build-nginx.rb.patch
new file mode 100644
index 0000000..f120c13
--- /dev/null
+++ b/contrib/src/passenger/build-nginx.rb.patch
@@ -0,0 +1,33 @@
+--- a/build/nginx.rb	2013-10-27 04:00:00.000000000 +0400
++++ b/build/nginx.rb	2020-11-23 11:36:59.000000000 +0300
+@@ -39,13 +39,12 @@
+ desc "Build Nginx support files"
+ task :nginx => [
+   :nginx_without_native_support,
+-  NATIVE_SUPPORT_TARGET
++  LIBBOOST_OXT,
+ ].compact
+ 
+ desc "Build Nginx support files, including objects suitable for dynamic linking against Nginx"
+ task 'nginx:as_dynamic_module' => [
+   :nginx_dynamic_without_native_support,
+-  NATIVE_SUPPORT_TARGET
+ ].compact
+ 
+ # Workaround for https://github.com/jimweirich/rake/issues/274
+@@ -53,7 +52,6 @@
+ 
+ task :nginx_without_native_support => [
+   auto_generated_sources,
+-  AGENT_TARGET,
+   COMMON_LIBRARY.only(*NGINX_LIBS_SELECTOR).link_objects
+ ].flatten
+ 
+@@ -61,7 +59,6 @@
+ # it also creates a namespace:clean task to clean up the output_dir
+ task :nginx_dynamic_without_native_support => [
+   auto_generated_sources,
+-  AGENT_TARGET,
+   define_libboost_oxt_task("nginx", NGINX_DYNAMIC_OUTPUT_DIR + "libboost_oxt", "-fPIC"),
+   COMMON_LIBRARY.only(*NGINX_LIBS_SELECTOR).
+     set_namespace("nginx").set_output_dir(NGINX_DYNAMIC_OUTPUT_DIR + "module_libpassenger_common").define_tasks("-fPIC").
diff --git a/contrib/src/passenger/src-nginx_module-ContentHandler.c.patch b/contrib/src/passenger/src-nginx_module-ContentHandler.c.patch
new file mode 100644
index 0000000..b81c3ae
--- /dev/null
+++ b/contrib/src/passenger/src-nginx_module-ContentHandler.c.patch
@@ -0,0 +1,14 @@
+# see https://github.com/phusion/passenger/pull/1841
+--- a/src/nginx_module/ContentHandler.c	2013-10-27 00:00:00.000000000 +0000
++++ b/src/nginx_module/ContentHandler.c	2020-12-17 14:10:27.556476564 +0000
+@@ -656,7 +656,9 @@
+         state->content_length.len = ngx_snprintf(state->content_length.data,
+             sizeof("4294967295") - 1, "%O", r->headers_in.content_length_n)
+             - state->content_length.data;
+-    } // else: content_length not used
++    } else { // else: content_length not used
++        state->content_length.len = 0;
++    }
+
+     state->core_password.data = (u_char *) psg_watchdog_launcher_get_core_password(
+         psg_watchdog_launcher, &len);
diff --git a/contrib/src/passenger/version b/contrib/src/passenger/version
new file mode 100644
index 0000000..f7552d5
--- /dev/null
+++ b/contrib/src/passenger/version
@@ -0,0 +1 @@
+PASSENGER_VERSION := 6.0.6
diff --git a/contrib/src/set-misc-nginx-module/Makefile b/contrib/src/set-misc-nginx-module/Makefile
new file mode 100644
index 0000000..0ecfb35
--- /dev/null
+++ b/contrib/src/set-misc-nginx-module/Makefile
@@ -0,0 +1,20 @@
+# set-misc-nginx-module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+SET_MISC_NGINX_MODULE_URL := $(GITHUB)/openresty/set-misc-nginx-module/archive/v$(SET_MISC_NGINX_MODULE_VERSION).tar.gz
+
+PKGS += set-misc-nginx-module
+
+$(TARBALLS)/set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(SET_MISC_NGINX_MODULE_URL),set-misc-nginx-module)
+
+.sum-set-misc-nginx-module: set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION).tar.gz
+
+set-misc-nginx-module: set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION).tar.gz .sum-set-misc-nginx-module
+	$(UNPACK)
+	$(MOVE)
+
+DEPS_set-misc-nginx-module = ngx_devel_kit $(DEPS_ngx_devel_kit)
+
+.set-misc-nginx-module: set-misc-nginx-module
+	touch $@
diff --git a/contrib/src/set-misc-nginx-module/SHA512SUMS b/contrib/src/set-misc-nginx-module/SHA512SUMS
new file mode 100644
index 0000000..cb80f18
--- /dev/null
+++ b/contrib/src/set-misc-nginx-module/SHA512SUMS
@@ -0,0 +1 @@
+5590526f60c99630f99a49bfa9e3455baee6d58cd2a1419eab1367a838dafb87a50f5e2607aa8ac557b90dbf633dcf61069c997b3526cddc8f2fc45820a7bc3b  set-misc-nginx-module-0.32.tar.gz
diff --git a/contrib/src/set-misc-nginx-module/version b/contrib/src/set-misc-nginx-module/version
new file mode 100644
index 0000000..98ee11d
--- /dev/null
+++ b/contrib/src/set-misc-nginx-module/version
@@ -0,0 +1 @@
+SET_MISC_NGINX_MODULE_VERSION := 0.32
diff --git a/contrib/src/stream-lua-nginx-module/Makefile b/contrib/src/stream-lua-nginx-module/Makefile
new file mode 100644
index 0000000..d2222ac
--- /dev/null
+++ b/contrib/src/stream-lua-nginx-module/Makefile
@@ -0,0 +1,21 @@
+# stream-lua-nginx-module
+
+include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version
+STREAM_LUA_NGINX_MODULE_URL := $(GITHUB)/openresty/stream-lua-nginx-module/archive/v$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz
+
+PKGS += stream-lua-nginx-module
+
+$(TARBALLS)/stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz:
+	$(call download_pkg,$(STREAM_LUA_NGINX_MODULE_URL),stream-lua-nginx-module)
+
+.sum-stream-lua-nginx-module: stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz
+
+stream-lua-nginx-module: stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz .sum-stream-lua-nginx-module
+	$(UNPACK)
+	$(APPLY) $(SRC)/stream-lua-nginx-module/config.patch
+	$(MOVE)
+
+DEPS_stream-lua-nginx-module = luajit2 $(DEPS_luajit2) ngx_devel_kit $(DEPS_ngx_devel_kit)
+
+.stream-lua-nginx-module: stream-lua-nginx-module
+	touch $@
diff --git a/contrib/src/stream-lua-nginx-module/SHA512SUMS b/contrib/src/stream-lua-nginx-module/SHA512SUMS
new file mode 100644
index 0000000..e7226f3
--- /dev/null
+++ b/contrib/src/stream-lua-nginx-module/SHA512SUMS
@@ -0,0 +1 @@
+82cd43956feaded415881a21f186edd0bdcf416cb7148d0cabe2567aee27479b0db24bbdcc7d3f5a16d7d1b6c5cf2aeb9fca25145bd2df1c900655fa967569db  stream-lua-nginx-module-0.0.9.tar.gz
diff --git a/contrib/src/stream-lua-nginx-module/config.patch b/contrib/src/stream-lua-nginx-module/config.patch
new file mode 100644
index 0000000..2fc73f7
--- /dev/null
+++ b/contrib/src/stream-lua-nginx-module/config.patch
@@ -0,0 +1,26 @@
+--- a/config	2015-12-20 05:43:48.000000000 +0000
++++ b/config	2015-12-25 08:01:04.138004474 +0000
+@@ -45,9 +45,9 @@
+         NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT"
+ 
+         if [ $NGX_RPATH = YES ]; then
+-            ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++            ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a -R$LUAJIT_LIB $luajit_ld_opt"
+         else
+-            ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++            ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a $ngx_lua_opt_L $luajit_ld_opt"
+         fi
+ 
+         . auto/feature
+@@ -71,9 +71,9 @@
+             NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT"
+ 
+             if [ $NGX_RPATH = YES ]; then
+-                ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++                ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a -R$LUAJIT_LIB $luajit_ld_opt"
+             else
+-                ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt"
++                ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a $luajit_ld_opt"
+             fi
+ 
+             . auto/feature
diff --git a/contrib/src/stream-lua-nginx-module/version b/contrib/src/stream-lua-nginx-module/version
new file mode 100644
index 0000000..7744542
--- /dev/null
+++ b/contrib/src/stream-lua-nginx-module/version
@@ -0,0 +1 @@
+STREAM_LUA_NGINX_MODULE_VERSION := 0.0.9
diff --git a/contrib/tarballs/.hgignore b/contrib/tarballs/.hgignore
new file mode 100644
index 0000000..8d876d7
--- /dev/null
+++ b/contrib/tarballs/.hgignore
@@ -0,0 +1,3 @@
+syntax:glob
+*.tar.*
+*.githash
diff --git a/debian/Makefile b/debian/Makefile
index 7a4c58c..7d0105f 100644
--- a/debian/Makefile
+++ b/debian/Makefile
@@ -9,6 +9,8 @@
 DOCS?=		../docs
 BUILD_ENV_PATH=	${HOME}/debuild
 MODULE_TARGET?=	oss
+CONTRIB?=	../contrib
+CONTRIB:=	$(abspath $(CONTRIB))
 
 ifeq ($(MODULE_TARGET), plus)
 MODULE_CONTROL_TEMPLATE=   nginx-plus-module.control.in
@@ -26,15 +28,16 @@
 MODULE_TARGET_PREFIX=$(TARGET_VERSION)+
 
 MODULE_PACKAGE_VENDOR=	Sergey Budnevitch <sb@nginx.com>
-MODULE_PACKAGE_URL=	http://nginx.org/
+MODULE_PACKAGE_URL=	https://nginx.org/
 
 CODENAME=	$(shell lsb_release -cs)
 ARCH=		$(shell uname -m)
 NPROC=		$(shell getconf _NPROCESSORS_ONLN)
 MODSRC_PREFIX=	extra/
-MODSRC_PATH=	$(MODSRC_PREFIX)
 BUILD_DIR=	$$(BUILDDIR_nginx)
 
+BASE_MODULES=	geoip image-filter njs perl xslt
+
 MODULES=
 
 -include Makefile.module-*
@@ -82,14 +85,28 @@
 
 export CR=\\n
 
-modname = $(shell echo $1 | cut -d '-' -f 3- | tr '-' '_')
+modname = $(shell echo $1 | tr '-' '_')
 
 default:
 	@echo "valid targets: all base $(addprefix module-, $(MODULES)) test test-debug"
 
-all:	base modules
+list-base:
+	@printf "%-20s\t%s\n" nginx $(BASE_VERSION)-$(BASE_RELEASE)
+
+list-module-%:
+	@printf "%-20s\t%s\n" $* $(MODULE_VERSION_$(call modname, $*))-$(MODULE_RELEASE_$(call modname, $*))
+
+list-all-modules: $(addprefix list-module-, $(MODULES))
+
+list-base-modules: $(addprefix list-module-, $(BASE_MODULES))
+
+list: list-base list-all-modules
+
+all:	base base-modules
 	@echo "===> all done"
 
+base-modules:	$(addprefix module-, $(BASE_MODULES))
+
 modules:	$(addprefix module-, $(MODULES))
 
 rules:	rules-base $(addprefix rules-module-, $(MODULES))
@@ -101,15 +118,8 @@
 	ln -s debuild-base/$(SRCDIR)/debian/nginx/usr/sbin base
 
 $(BASE_SRC):
-	@{ \
-	if [ -f $(SRCPATH)/$(BASE_SRC) ]; then \
-		cp -P $(SRCPATH)/$(BASE_SRC) $(BASE_SRC) ; \
-	elif [ -f $(SRCPATH)/nginx_$(BASE_VERSION).orig.tar.gz ]; then \
-		cp -P $(SRCPATH)/nginx_$(BASE_VERSION).orig.tar.gz $(BASE_SRC) ; \
-	else \
-		wget http://nginx.org/download/$(BASE_SRC) ; \
-	fi ; \
-	}
+	cd $(CONTRIB) && make .sum-nginx
+	ln -s $(CONTRIB)/tarballs/$(BASE_SRC) $(BASE_SRC)
 
 nginx.deb-changelog:
 	@echo "===> Generating $@"
@@ -161,7 +171,7 @@
 	}
 
 
-rules-module-%: $(BASE_SRC) nginx-module-%.deb-changelog
+rules-module-%: $(BASE_SRC) nginx-module-%.deb-changelog .deps-module-%
 	@echo "===> Creating $@"
 	@{ \
 	set -e ; \
@@ -170,10 +180,10 @@
 	builddir=`echo debuild-module-$${module_asis}` ; \
 	mkdir -p $${builddir} ; \
 	if [ "$(MODULE_TARGET)" = "oss" ]; then \
-		module_version="$(MODULE_VERSION_PREFIX_$(call modname, $@))$(MODULE_VERSION_$(call modname, $@))" ; \
+		module_version="$(MODULE_VERSION_PREFIX_$(call modname, $*))$(MODULE_VERSION_$(call modname, $*))" ; \
 		orig_name="nginx-module-$${module_asis}_$${module_version}.orig.tar.gz" ; \
 	else \
-		module_version="$(MODULE_VERSION_PREFIX_$(call modname, $@))$(MODULE_VERSION_$(call modname, $@))" ; \
+		module_version="$(MODULE_VERSION_PREFIX_$(call modname, $*))$(MODULE_VERSION_$(call modname, $*))" ; \
 		orig_name="nginx-plus-module-$${module_asis}_$${module_version}.orig.tar.gz" ; \
 	fi ; \
 	cp $(BASE_SRC) $${builddir}/$${orig_name} ; \
@@ -182,36 +192,43 @@
 	mkdir -p $${builddir}/$(SRCDIR)/debian/source ; \
 	echo "3.0 (quilt)" > $${builddir}/$(SRCDIR)/debian/source/format ; \
 	echo "9" > $${builddir}/$(SRCDIR)/debian/compat ; \
-	for src in $(MODULE_SOURCES_$(call modname, $@)); do \
-		tar -C $${builddir}/$(SRCDIR)/debian/extra -xf extra/$${src} ; \
+	for src in $(MODULE_SOURCES_$(call modname, $*)); do \
+		tar -C $${builddir}/$(SRCDIR)/debian/extra -xvf $(CONTRIB)/tarballs/$${src} ; \
+		sn=`echo $${src} | sed -e 's/-[0-9].*$$//'` ; \
+		if [ "$${sn}" = "$${src}" ] ; then \
+			sn=$${src%-*} ; \
+		fi ; \
+		( cd $${builddir}/$(SRCDIR)/debian/extra && ln -s $${sn}-* $${sn} ) ; \
 	done ; \
-	for p in $(MODULE_PATCHES_$(call modname, $@)); do \
-		( cd $${builddir}/$(SRCDIR)/debian/extra && patch -p1 < $${curdir}/extra/$${p} ) ; \
+	for p in $(MODULE_PATCHES_$(call modname, $*)); do \
+		dn=`dirname $${p}` ; \
+		bdn=`basename $${dn}` ; \
+		( cd $${builddir}/$(SRCDIR)/debian/extra/$${bdn} && patch -p1 < $${p} ) ; \
 	done ; \
 	( cd $${builddir}/$(SRCDIR) && find debian/ -type f -exec file --mime {} \; | fgrep 'charset=binary' | cut -d ':' -f 1 > include-binaries && mv include-binaries debian/source/ ) ; \
 	module_copyright="nginx-module-$${module_asis}.copyright" ; \
 	cp -p $(DOCS)/$${module_copyright} $${builddir}/$(SRCDIR)/debian/copyright ; \
-	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	addcontroltags=`echo "$$MODULE_ADD_CONTROL_TAGS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	buildenv=`echo "$$MODULE_ENV_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	post=`echo "$$MODULE_POST_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	addcontroltags=`echo "$$MODULE_ADD_CONTROL_TAGS_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	buildenv=`echo "$$MODULE_ENV_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	post=`echo "$$MODULE_POST_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
 	cat $(MODULE_CONTROL_TEMPLATE) | sed \
 		-e "s#%%MODULE%%#$${module_asis}#g" \
 		-e "s#%%MODULE_PACKAGE_VENDOR%%#$(MODULE_PACKAGE_VENDOR)#g" \
 		-e "s#%%MODULE_PACKAGE_URL%%#$(MODULE_PACKAGE_URL)#g" \
-		-e "s#%%SUMMARY%%#$(MODULE_SUMMARY_PREFIX) $(MODULE_SUMMARY_$(call modname, $@))#g" \
-		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $@))#g" \
+		-e "s#%%SUMMARY%%#$(MODULE_SUMMARY_PREFIX) $(MODULE_SUMMARY_$(call modname, $*))#g" \
+		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $*))#g" \
 		-e "s#%%CODENAME%%#$(CODENAME)#g" \
 		-e "s#%%BASE_VERSION%%#$(BASE_VERSION)#g" \
 		-e "s#%%BASE_RELEASE%%#$(BASE_RELEASE)#g" \
 		-e "s#%%PLUS_VERSION%%#$(PLUS_VERSION)#g" \
-		-e "s#%%VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $@))#g" \
-		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $@))#g" \
-		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $@))#g" \
-		-e "s#%%MODULE_BUILD_DEPENDS%%#$(MODULE_BUILD_DEPENDS_$(call modname, $@))#g" \
-		-e "s#%%MODULE_DEPENDS%%#$(MODULE_DEPENDS_$(call modname, $@))#g" \
+		-e "s#%%VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $*))#g" \
+		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $*))#g" \
+		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $*))#g" \
+		-e "s#%%MODULE_BUILD_DEPENDS%%#$(MODULE_BUILD_DEPENDS_$(call modname, $*))#g" \
+		-e "s#%%MODULE_DEPENDS%%#$(MODULE_DEPENDS_$(call modname, $*))#g" \
 		-e "s#%%ADD_CONTROL_TAGS%%#$${addcontroltags}#g" \
 	> $${builddir}/$(SRCDIR)/debian/control ; \
 	cat nginx-module-$*.deb-changelog | sed \
@@ -221,9 +238,9 @@
 		-e "s#%%PLUS_VERSION%%#$(PLUS_VERSION)#g" \
 		-e "s#%%MODULE%%#$${module_asis}#g" \
 		-e "s#%%CODENAME%%#$(CODENAME)#g" \
-		-e "s#%%VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $@))#g" \
-		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $@))#g" \
-		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $@))#g" \
+		-e "s#%%VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $*))#g" \
+		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $*))#g" \
+		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $*))#g" \
 	> $${builddir}/$(SRCDIR)/debian/changelog ; \
 	cat nginx-module.rules.in | sed \
 		-e "s#%%MODULE%%#$${module_asis}#g" \
@@ -232,14 +249,14 @@
 		-e "s#%%BASE_RELEASE%%#$(BASE_RELEASE)#g" \
 		-e "s#%%TARGET_SUFFIX%%#$(TARGET_SUFFIX)#g" \
 		-e "s#%%BASE_CONFIGURE_ARGS%%#$(BASE_CONFIGURE_ARGS)#g" \
-		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $@))#g" \
+		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $*))#g" \
 		-e "s#%%MODULE_DEFINITIONS%%#$${definitions}#g" \
 		-e "s#%%MODULE_PREBUILD%%#$${prebuild}#g" \
 		-e "s#%%MODULE_ENV%%#$${buildenv}#g" \
-		-e "s#%%MODULE_CC_OPT%%#$(MODULE_CC_OPT_$(call modname, $@))#g" \
-		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $@))#g" \
-		-e "s#%%MODULE_LD_OPT%%#$(MODULE_LD_OPT_$(call modname, $@))#g" \
-		-e "s#%%MODULE_LD_OPT_DEBUG%%#$(MODULE_LD_OPT_DEBUG_$(call modname, $@))#g" \
+		-e "s#%%MODULE_CC_OPT%%#$(MODULE_CC_OPT_$(call modname, $*))#g" \
+		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $*))#g" \
+		-e "s#%%MODULE_LD_OPT%%#$(MODULE_LD_OPT_$(call modname, $*))#g" \
+		-e "s#%%MODULE_LD_OPT_DEBUG%%#$(MODULE_LD_OPT_DEBUG_$(call modname, $*))#g" \
 		-e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \
 	> $${builddir}/$(SRCDIR)/debian/rules ; \
 	cat nginx-module.postinst.in | sed \
@@ -249,6 +266,9 @@
 	ln -s $${builddir}/$(SRCDIR)/debian/rules $@ ; \
 	}
 
+.deps-module-%:
+	touch $@
+
 nginx-tests:
 	@{ \
 	if [ -d "$(SRCPATH)/nginx-tests" ]; then \
@@ -256,7 +276,7 @@
 		cp -rP $(SRCPATH)/nginx-tests nginx-tests ; \
 	else \
 		echo "===> Cloning tests" ; \
-		hg clone http://hg.nginx.org/nginx-tests ; \
+		hg clone https://hg.nginx.org/nginx-tests ; \
 	fi ; \
 	}
 
@@ -265,6 +285,8 @@
 	@{ \
 	pwd=`pwd` ; \
 	globals= ; \
+	globals_http= ; \
+	globals_stream= ; \
 	for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \
 		globals="$$globals load_module $$pwd/$$so;" ; \
 	done ; \
@@ -272,12 +294,16 @@
 		globals="$$globals env PERL5LIB=$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx/objs/src/http/modules/perl:$$pwd/debuild-module-perl/nginx-$(BASE_VERSION)/debian/build-nginx/objs/src/http/modules/perl/blib/arch;" ; \
 	fi ; \
 	if [ -d $$pwd/debuild-module-modsecurity ]; then \
-		export LD_LIBRARY_PATH=$$pwd/debuild-module-modsecurity/$(SRCDIR)/debian/build-nginx/extra/modsecurity-v$(LIBMODSECURITY_VERSION)/local/lib ; \
+		export LD_LIBRARY_PATH=$$pwd/debuild-module-modsecurity/$(SRCDIR)/debian/build-nginx/extra/modsecurity-v$(MODSECURITY_VERSION)/local/lib ; \
 	fi ; \
 	if [ -d $$pwd/debuild-module-opentracing ]; then \
 		export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$pwd/debuild-module-opentracing/$(SRCDIR)/debian/build-nginx/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib ; \
 	fi ; \
-	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove . ; \
+	if [ -d $$pwd/debuild-module-lua ]; then \
+		globals_http="lua_package_path '$$pwd/debuild-module-lua/nginx-$(BASE_VERSION)/debian/extra/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/debuild-module-lua/nginx-$(BASE_VERSION)/debian/extra/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \
+		globals_stream="$$globals_http" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \
 	}
 
 test-debug: base nginx-tests
@@ -285,6 +311,8 @@
 	@{ \
 	pwd=`pwd` ; \
 	globals= ; \
+	globals_http= ; \
+	globals_stream= ; \
 	for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \
 		globals="$$globals load_module $$pwd/$$so;" ; \
 	done ; \
@@ -292,44 +320,47 @@
 		globals="$$globals env PERL5LIB=$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx-debug/objs/src/http/modules/perl:$$pwd/debuild-module-perl/nginx-$(BASE_VERSION)/debian/build-nginx/objs/src/http/modules/perl/blib/arch;" ; \
 	fi ; \
 	if [ -d $$pwd/debuild-module-modsecurity ]; then \
-		export LD_LIBRARY_PATH=$$pwd/debuild-module-modsecurity/$(SRCDIR)/debian/build-nginx-debug/extra/modsecurity-v$(LIBMODSECURITY_VERSION)/local/lib ; \
+		export LD_LIBRARY_PATH=$$pwd/debuild-module-modsecurity/$(SRCDIR)/debian/build-nginx-debug/extra/modsecurity-v$(MODSECURITY_VERSION)/local/lib ; \
 	fi ; \
 	if [ -d $$pwd/debuild-module-opentracing ]; then \
 		export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$pwd/debuild-module-opentracing/$(SRCDIR)/debian/build-nginx-debug/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib ; \
 	fi ; \
-	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" prove . ; \
+	if [ -d $$pwd/debuild-module-lua ]; then \
+		globals_http="lua_package_path '$$pwd/debuild-module-lua/nginx-$(BASE_VERSION)/debian/extra/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/debuild-module-lua/nginx-$(BASE_VERSION)/debian/extra/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \
+		globals_stream="$$globals_http" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \
 	}
 
-prepare-build-env: $(BASE_SRC)
+test-modules: $(addprefix test-module-, $(MODULES))
+
+test-module-%: base nginx-tests module-%
 	@{ \
-	set -e ; \
-	cwd=`pwd` ; \
-	case $$cwd in $(BUILD_ENV_PATH)*) \
-		echo "You are in $(BUILD_ENV_PATH), skipping" >&2 ; \
-		exit 1 ; \
-	esac ; \
-	if [ -e $(BUILD_ENV_PATH) ]; then \
-		echo "$(BUILD_ENV_PATH) is already exists and going to be removed." ; \
-		echo "Press Enter to continue or Ctrl+C to exit" ; \
-		read ; \
-		rm -rf $(BUILD_ENV_PATH) ; \
+	module=`echo $@ | cut -d '-' -f 3-` ; \
+	testdir="$(MODULE_TESTS_$(shell echo $@ | cut -d '-' -f 3-))" ; \
+	if [ -z "$$testdir" ]; then \
+		echo "---> Skipping, no tests defined for $$module module" ; \
+		exit 0 ; \
 	fi ; \
-	mkdir -p $(BUILD_ENV_PATH) ; \
-	tar -C $(BUILD_ENV_PATH) -xf $(BASE_SRC) ; \
-	cp -rP $${cwd} $(BUILD_ENV_PATH)/nginx-$(BASE_VERSION)/ ; \
-	cp $(BASE_SRC) $(BUILD_ENV_PATH)/nginx_$(BASE_VERSION).orig.tar.gz ; \
-	cp -pr $(DOCS) $(BUILD_ENV_PATH)/$(SRCDIR)/; \
-	echo "Build environment has been created in: $(BUILD_ENV_PATH)" ; \
-	echo ; \
-	echo "Please do the following in order to get available build targets:" ; \
-	echo "    cd $(BUILD_ENV_PATH)/nginx-$(BASE_VERSION)/debian" ; \
-	echo "    make" ; \
+	pwd=`pwd` ; \
+	globals= ; \
+	if [ "$$module" = "modsecurity" ]; then \
+		export LD_LIBRARY_PATH=$$pwd/debuild-module-modsecurity/$(SRCDIR)/debian/build-nginx/extra/modsecurity-v$(MODSECURITY_VERSION)/local/lib ; \
+	fi ; \
+	for so in `find module-$${module}/ -maxdepth 1 -type f -name "*module.so"`; do \
+		globals="$$globals load_module $$pwd/$$so;" ; \
+	done ; \
+	if [ ! -d nginx-tests/module-$${module} ]; then \
+		cp -r $${pwd}/debuild-module-$${module}/$(SRCDIR)/debian/extra/$${testdir} nginx-tests/module-$${module} ; \
+		ln -fs ../lib nginx-tests/module-$${module}/lib ; \
+	fi ; \
+	cd nginx-tests/module-$${module} && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
 	}
 
 clean:
-	@rm -rf base module-* rules-base rules-module-* debuild-base debuild-module-* nginx-tests $(BASE_SRC)
+	@rm -rf base module-* rules-base rules-module-* debuild-base debuild-module-* nginx-tests $(BASE_SRC) .deps-module-*
 	@rm -f nginx.deb-changelog nginx-module-*.deb-changelog
 
-.PHONY:	default all modules rules test test-debug clean
+.PHONY:	default list list-base list-all-modules list-base-modules all modules rules test test-debug clean
 
 .SECONDARY:
diff --git a/debian/Makefile.module-brotli b/debian/Makefile.module-brotli
new file mode 100644
index 0000000..589c8cb
--- /dev/null
+++ b/debian/Makefile.module-brotli
@@ -0,0 +1,39 @@
+MODULES+=	brotli
+
+MODULE_SUMMARY_brotli=	3rd-party brotli compression dynamic modules
+
+include $(CONTRIB)/src/ngx_brotli/version
+
+MODULE_VERSION_brotli=	$(NGX_BROTLI_VERSION)
+MODULE_RELEASE_brotli=	1
+
+MODULE_VERSION_PREFIX_brotli=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_brotli=	ngx_brotli-$(NGX_BROTLI_VERSION).tar.gz
+
+MODULE_CONFARGS_brotli=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_brotli-$(NGX_BROTLI_VERSION)rc
+
+.deps-module-brotli:
+	cd $(CONTRIB) && make .sum-ngx_brotli
+	touch $@
+
+MODULE_BUILD_DEPENDS_brotli=,libbrotli-dev
+
+define MODULE_POST_brotli
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_brotli) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_brotli_filter_module.so;
+    load_module modules/ngx_http_brotli_static_module.so;
+
+Please refer to the modules documentation for further details:
+https://github.com/google/ngx_brotli
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_brotli
diff --git a/debian/Makefile.module-encrypted-session b/debian/Makefile.module-encrypted-session
new file mode 100644
index 0000000..34dcedd
--- /dev/null
+++ b/debian/Makefile.module-encrypted-session
@@ -0,0 +1,52 @@
+MODULES+=	encrypted-session
+
+MODULE_SUMMARY_encrypted_session=	3rd-party encrypted session dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/encrypted-session-nginx-module/version
+
+MODULE_VERSION_encrypted_session=	$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION)
+MODULE_RELEASE_encrypted_session=	1
+
+MODULE_VERSION_PREFIX_encrypted_session=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_encrypted_session=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+					encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_encrypted_session=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+					--add-dynamic-module=$(MODSRC_PREFIX)encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION)
+
+.deps-module-encrypted-session:
+	cd $(CONTRIB) && make \
+		.sum-ngx_devel_kit \
+		.sum-encrypted-session-nginx-module
+	touch $@
+
+MODULE_DEPENDS_encrypted_session=,$(NDK_DEPENDENCY_TAG)
+
+define MODULE_PREINSTALL_encrypted_session
+	rm -f $$(BUILDDIR_nginx_debug)/objs/ndk_http_module-debug.so
+	rm -f $$(BUILDDIR_nginx)/objs/ndk_http_module.so
+endef
+export MODULE_PREINSTALL_encrypted_session
+
+define MODULE_POST_encrypted_session
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_encrypted_session) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_encrypted_session_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+Please refer to the modules documentation for further details:
+https://github.com/openresty/encrypted-session-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_encrypted_session
diff --git a/debian/Makefile.module-geoip b/debian/Makefile.module-geoip
index 5823ed0..1152422 100644
--- a/debian/Makefile.module-geoip
+++ b/debian/Makefile.module-geoip
@@ -9,7 +9,6 @@
 			--with-stream_geoip_module=dynamic
 
 MODULE_BUILD_DEPENDS_geoip=,libgeoip-dev
-MODULE_DEPENDS_geoip=,libgeoip1
 
 define MODULE_POST_geoip
 cat <<BANNER
@@ -23,8 +22,8 @@
     load_module modules/ngx_stream_geoip_module.so;
 
 Please refer to the modules documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_geoip_module.html
-http://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
+https://nginx.org/en/docs/http/ngx_http_geoip_module.html
+https://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/debian/Makefile.module-geoip2 b/debian/Makefile.module-geoip2
new file mode 100644
index 0000000..1bf53c1
--- /dev/null
+++ b/debian/Makefile.module-geoip2
@@ -0,0 +1,40 @@
+MODULES+=	geoip2
+
+MODULE_SUMMARY_geoip2=	3rd-party GeoIP2 dynamic modules
+
+include $(CONTRIB)/src/ngx_http_geoip2_module/version
+
+MODULE_VERSION_geoip2=	$(GEOIP2_NGINX_MODULE_VERSION)
+MODULE_RELEASE_geoip2=	1
+
+MODULE_VERSION_PREFIX_geoip2=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_geoip2=	ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_geoip2=	--with-stream \
+			--add-dynamic-module=$(MODSRC_PREFIX)ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION)
+
+.deps-module-geoip2:
+	cd $(CONTRIB) && make .sum-ngx_http_geoip2_module
+	touch $@
+
+MODULE_BUILD_DEPENDS_geoip2=, libmaxminddb-dev
+
+define MODULE_POST_geoip2
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_geoip2) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_geoip2_module.so;
+    load_module modules/ngx_stream_geoip2_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/leev/ngx_http_geoip2_module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_geoip2
diff --git a/debian/Makefile.module-headers-more b/debian/Makefile.module-headers-more
new file mode 100644
index 0000000..560f043
--- /dev/null
+++ b/debian/Makefile.module-headers-more
@@ -0,0 +1,38 @@
+MODULES+=	headers-more
+
+MODULE_SUMMARY_headers_more=	3rd-party headers-more dynamic module
+
+include $(CONTRIB)/src/headers-more-nginx-module/version
+
+MODULE_VERSION_headers_more=	$(HEADERS_MORE_NGINX_MODULE_VERSION)
+MODULE_RELEASE_headers_more=	1
+
+MODULE_VERSION_PREFIX_headers_more=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_headers_more=	headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_headers_more=	--with-http_dav_module \
+				--with-http_realip_module \
+				--add-dynamic-module=$(MODSRC_PREFIX)headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION)
+
+.deps-module-headers-more:
+	cd $(CONTRIB) && make .sum-headers-more-nginx-module
+	touch $@
+
+define MODULE_POST_headers_more
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_headers_more) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_headers_more_filter_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/openresty/headers-more-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_headers_more
diff --git a/debian/Makefile.module-image-filter b/debian/Makefile.module-image-filter
index 5c54ebb..51dc347 100644
--- a/debian/Makefile.module-image-filter
+++ b/debian/Makefile.module-image-filter
@@ -20,7 +20,7 @@
     load_module modules/ngx_http_image_filter_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_image_filter_module.html
+https://nginx.org/en/docs/http/ngx_http_image_filter_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/debian/Makefile.module-lua b/debian/Makefile.module-lua
new file mode 100644
index 0000000..0c70931
--- /dev/null
+++ b/debian/Makefile.module-lua
@@ -0,0 +1,122 @@
+MODULES+=	lua
+
+MODULE_SUMMARY_lua=	3rd-party Lua dynamic modules
+
+include $(CONTRIB)/src/luajit2/version
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/lua-nginx-module/version
+include $(CONTRIB)/src/stream-lua-nginx-module/version
+include $(CONTRIB)/src/lua-resty-core/version
+include $(CONTRIB)/src/lua-resty-lrucache/version
+
+MODULE_VERSION_lua=	$(LUA_NGINX_MODULE_VERSION)
+MODULE_RELEASE_lua=	1
+
+MODULE_VERSION_PREFIX_lua=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_lua=	ngx_devel_kit-$(MODULE_VERSION_ndk).tar.gz \
+			lua-nginx-module-$(MODULE_VERSION_lua).tar.gz \
+			stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz \
+			luajit2-$(LUAJIT2_VERSION).tar.gz \
+			lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz \
+			lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz
+
+MODULE_PATCHES_lua=	$(CONTRIB)/src/luajit2/Makefile.patch \
+			$(CONTRIB)/src/luajit2/src-luaconf.h.patch \
+			$(CONTRIB)/src/lua-nginx-module/config.patch \
+			$(CONTRIB)/src/stream-lua-nginx-module/config.patch
+
+MODULE_CONFARGS_lua=	--with-http_dav_module \
+			--with-http_realip_module \
+			--with-http_ssl_module \
+			--with-http_v2_module \
+			--with-stream \
+			--with-stream_ssl_module \
+			--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+			--add-dynamic-module=$(MODSRC_PREFIX)lua-nginx-module-$(LUA_NGINX_MODULE_VERSION) \
+			--add-dynamic-module=$(MODSRC_PREFIX)stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION)
+
+.deps-module-lua:
+	cd $(CONTRIB) && make \
+		.sum-luajit2 \
+		.sum-ngx_devel_kit \
+		.sum-lua-nginx-module \
+		.sum-stream-lua-nginx-module \
+		.sum-lua-resty-core \
+		.sum-lua-resty-lrucache
+	touch $@
+
+MODULE_DEPENDS_lua=,$(NDK_DEPENDENCY_TAG)
+
+define MODULE_DEFINITIONS_lua
+	USE_LUAJIT = 1
+	LUAJIT_INC_nginx=$$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1
+	LUAJIT_LIB_nginx=$$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/lib
+	LUAJIT_INC_nginx_debug=$$(BUILDDIR_nginx_debug)/extra/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1
+	LUAJIT_LIB_nginx_debug=$$(BUILDDIR_nginx_debug)/extra/luajit2-$(LUAJIT2_VERSION)/usr/lib
+endef
+export MODULE_DEFINITIONS_lua
+
+define MODULE_PREBUILD_lua
+	cd $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION) \&\& \
+	DESTDIR="$$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)" CFLAGS="-fPIC" $$(MAKE) -j$$(NUMJOBS) install
+	mv $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/bin/luajit $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/bin/nginx-luajit
+	mv $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/luajit.1 $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/nginx-luajit.1
+endef
+export MODULE_PREBUILD_lua
+
+define MODULE_ENV_lua
+LUAJIT_INC="$$(LUAJIT_INC_$$(shell echo $$@ | cut -d '.' -f 3))" LUAJIT_LIB="$$(LUAJIT_LIB_$$(shell echo $$@ | cut -d '.' -f 3))"
+endef
+export MODULE_ENV_lua
+
+define MODULE_PREINSTALL_lua
+	rm -f $$(BUILDDIR_nginx_debug)/objs/ndk_http_module-debug.so
+	rm -f $$(BUILDDIR_nginx)/objs/ndk_http_module.so
+	mkdir -p $$(INSTALLDIR)/usr/bin
+	mkdir -p $$(INSTALLDIR)/usr/share/man/man1
+	install -m755 $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/bin/nginx-luajit $$(INSTALLDIR)/usr/bin/
+	install -m644 $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/man/man1/nginx-luajit.1 $$(INSTALLDIR)/usr/share/man/man1/
+	mkdir -p $$(INSTALLDIR)/usr/share/nginx-luajit-2.1/jit
+	for f in `find $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/share/nginx-luajit-2.1/jit/ -type f`; do \
+		install -m644 $$$${f} $$(INSTALLDIR)/usr/share/nginx-luajit-2.1/jit/ ; \
+	done
+	mkdir -p $$(INSTALLDIR)/usr/include/nginx-luajit-2.1
+	for f in `find $$(BUILDDIR_nginx)/extra/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1/ -type f`; do \
+		install -m644 $$$${f} $$(INSTALLDIR)/usr/include/nginx-luajit-2.1/ ; \
+	done
+	mkdir -p $$(INSTALLDIR)/usr/share/nginx-luajit-2.1/resty
+	cd $$(BUILDDIR_nginx)/extra/lua-resty-core-$(LUA_RESTY_CORE_VERSION) \&\& \
+		LUA_LIB_DIR=$$(INSTALLDIR)/usr/share/nginx-luajit-2.1 make install
+	cd $$(BUILDDIR_nginx)/extra/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION) \&\& \
+		LUA_LIB_DIR=$$(INSTALLDIR)/usr/share/nginx-luajit-2.1 make install
+endef
+export MODULE_PREINSTALL_lua
+
+define MODULE_POST_lua
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_lua) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_lua_module.so;
+    load_module modules/ngx_stream_lua_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+These modules are compiled with LuaJIT 2.1 library.
+The following binary should be used for testing and bytecode generation:
+
+    /usr/bin/nginx-luajit
+
+Please refer to the modules documentation for further details:
+https://github.com/openresty/lua-nginx-module
+https://github.com/openresty/stream-lua-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_lua
diff --git a/debian/Makefile.module-modsecurity b/debian/Makefile.module-modsecurity
new file mode 100644
index 0000000..1a9997e
--- /dev/null
+++ b/debian/Makefile.module-modsecurity
@@ -0,0 +1,81 @@
+MODULES+=	modsecurity
+
+MODULE_SUMMARY_modsecurity=	3rd-party ModSecurity dynamic module
+
+include $(CONTRIB)/src/modsecurity/version
+include $(CONTRIB)/src/modsecurity-nginx/version
+
+MODULE_VERSION_modsecurity=	$(MODSECURITY_NGINX_VERSION)
+MODULE_RELEASE_modsecurity=	1
+LIBMODSECURITY_SOVER=		$(MODSECURITY_VERSION)
+
+MODULE_VERSION_PREFIX_modsecurity=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_modsecurity=	modsecurity-v$(MODSECURITY_VERSION).tar.gz \
+				modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz
+
+MODULE_PATCHES_modsecurity=	$(CONTRIB)/src/modsecurity/PR2348.patch \
+				$(CONTRIB)/src/modsecurity-nginx/PR165.patch
+
+MODULE_CONFARGS_modsecurity=	--add-dynamic-module=$(MODSRC_PREFIX)modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)
+
+.deps-module-modsecurity:
+	cd $(CONTRIB) && make \
+		.sum-modsecurity \
+		.sum-modsecurity-nginx
+	touch $@
+
+MODULE_BUILD_DEPENDS_modsecurity=,libxml2-dev,libyajl-dev,libcurl4-openssl-dev
+
+define MODULE_PREBUILD_modsecurity
+	cd $$(BUILDDIR_nginx)/extra/modsecurity-v$(MODSECURITY_VERSION) \&\& \
+	./configure --prefix $$(BUILDDIR_nginx)/extra/modsecurity-v$(MODSECURITY_VERSION)/local --without-lmdb --without-lua \&\& \
+	$$(MAKE) -j$$(NUMJOBS) install \&\& $$(MAKE) check-TESTS
+	rm -f /tmp/audit_test.log /tmp/audit_test_parallel.log
+	rm -rf /tmp/test
+endef
+export MODULE_PREBUILD_modsecurity
+
+define MODULE_ENV_modsecurity
+MODSECURITY_INC="$$(BUILDDIR_$$(shell echo $$@ | cut -d '.' -f 3))/extra/modsecurity-v$(MODSECURITY_VERSION)/local/include" \
+MODSECURITY_LIB="$$(BUILDDIR_$$(shell echo $$@ | cut -d '.' -f 3))/extra/modsecurity-v$(MODSECURITY_VERSION)/local/lib" \
+NGX_IGNORE_RPATH=YES
+endef
+export MODULE_ENV_modsecurity
+
+MODULE_CC_OPT_DEBUG_modsecurity=-DMODSECURITY_DDEBUG=1
+
+define MODULE_PREINSTALL_modsecurity
+	mkdir -p $$(INSTALLDIR)/usr/bin
+	install -m755 -s $$(BUILDDIR_nginx)/extra/modsecurity-v$(MODSECURITY_VERSION)/local/bin/modsec-rules-check $$(INSTALLDIR)/usr/bin/
+	mkdir -p $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)
+	install -m755 $$(BUILDDIR_nginx)/extra/modsecurity-v$(MODSECURITY_VERSION)/local/lib/libmodsecurity.so.$(LIBMODSECURITY_SOVER) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)
+	ln -fs libmodsecurity.so.$(LIBMODSECURITY_SOVER) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)/libmodsecurity.so.3
+	ln -fs libmodsecurity.so.$(LIBMODSECURITY_SOVER) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)/libmodsecurity.so
+	mkdir -p $$(INSTALLDIR)/etc/nginx/modsec
+	install -m644 $$(BUILDDIR_nginx)/extra/modsecurity-v$(MODSECURITY_VERSION)/modsecurity.conf-recommended $$(INSTALLDIR)/etc/nginx/modsec/modsecurity.conf
+	install -m644 $$(BUILDDIR_nginx)/extra/modsecurity-v$(MODSECURITY_VERSION)/unicode.mapping $$(INSTALLDIR)/etc/nginx/modsec/
+endef
+export MODULE_PREINSTALL_modsecurity
+
+MODULE_TESTS_modsecurity=modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)/tests
+
+define MODULE_POST_modsecurity
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_modsecurity) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_modsecurity_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/SpiderLabs/ModSecurity-nginx
+
+----------------------------------------------------------------------
+BANNER
+
+/sbin/ldconfig
+endef
+export MODULE_POST_modsecurity
diff --git a/debian/Makefile.module-ndk b/debian/Makefile.module-ndk
new file mode 100644
index 0000000..ab7624e
--- /dev/null
+++ b/debian/Makefile.module-ndk
@@ -0,0 +1,45 @@
+MODULES+=	ndk
+
+MODULE_SUMMARY_ndk=	3rd-party NDK dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+
+MODULE_VERSION_ndk=	$(NGX_DEVEL_KIT_VERSION)
+MODULE_RELEASE_ndk=	1
+
+MODULE_VERSION_PREFIX_ndk=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_ndk=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz
+
+MODULE_CONFARGS_ndk=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION)
+
+.deps-module-ndk:
+	cd $(CONTRIB) && make .sum-ngx_devel_kit
+	touch $@
+
+MODULE_CC_OPT_ndk=-DNDK_SET_VAR -DNDK_UPSTREAM_LIST
+MODULE_CC_OPT_DEBUG_ndk=$(MODULE_CC_OPT_ndk)
+
+ifeq ($(MODULE_TARGET), plus)
+NDK_DEPENDENCY_TAG=	nginx-plus-module-ndk-r$(PLUS_VERSION)
+else
+NDK_DEPENDENCY_TAG=	nginx-module-ndk-r$(BASE_VERSION)
+endif
+
+define MODULE_POST_ndk
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_ndk) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/simpl/ngx_devel_kit
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_ndk
diff --git a/debian/Makefile.module-njs b/debian/Makefile.module-njs
index 241236b..2e1109d 100644
--- a/debian/Makefile.module-njs
+++ b/debian/Makefile.module-njs
@@ -2,27 +2,33 @@
 
 MODULE_SUMMARY_njs=	njs dynamic modules
 
-MODULE_VERSION_njs=	0.5.0
+include $(CONTRIB)/src/njs/version
+
+MODULE_VERSION_njs=	$(NJS_VERSION)
 MODULE_RELEASE_njs=	1
 
-MODULE_SOURCES_njs=	njs-$(MODULE_VERSION_njs).tar.gz
+MODULE_SOURCES_njs=	njs-$(NJS_VERSION).tar.gz
 
-MODULE_CONFARGS_njs=	--add-dynamic-module=$(MODSRC_PREFIX)njs-$(MODULE_VERSION_njs)/nginx
+MODULE_CONFARGS_njs=	--add-dynamic-module=$(MODSRC_PREFIX)njs-$(NJS_VERSION)/nginx
+
+.deps-module-njs:
+	cd $(CONTRIB) && make .sum-njs
+	touch $@
 
 MODULE_VERSION_PREFIX_njs=$(MODULE_TARGET_PREFIX)
 
 MODULE_BUILD_DEPENDS_njs=,libedit-dev
 
 define MODULE_PREBUILD_njs
-	cd debian/extra/njs-$(MODULE_VERSION_njs) \&\& ./configure \&\& make njs
+	cd debian/extra/njs-$(NJS_VERSION) \&\& ./configure \&\& make njs
 endef
 export MODULE_PREBUILD_njs
 
 define MODULE_PREINSTALL_njs
 	mkdir -p $$(INSTALLDIR)/usr/share/doc/nginx-module-njs
-	install -m644 $$(BUILDDIR_nginx)/extra/njs-$(MODULE_VERSION_njs)/CHANGES $$(INSTALLDIR)/usr/share/doc/nginx-module-njs/
+	install -m644 $$(BUILDDIR_nginx)/extra/njs-$(NJS_VERSION)/CHANGES $$(INSTALLDIR)/usr/share/doc/nginx-module-njs/
 	mkdir -p $$(INSTALLDIR)/usr/bin
-	install -m755 $$(CURDIR)/debian/extra/njs-$(MODULE_VERSION_njs)/build/njs $$(INSTALLDIR)/usr/bin/
+	install -m755 $$(CURDIR)/debian/extra/njs-$(NJS_VERSION)/build/njs $$(INSTALLDIR)/usr/bin/
 endef
 export MODULE_PREINSTALL_njs
 
@@ -38,9 +44,9 @@
     load_module modules/ngx_stream_js_module.so;
 
 Please refer to the modules documentation for further details:
-http://nginx.org/en/docs/njs/
-http://nginx.org/en/docs/http/ngx_http_js_module.html
-http://nginx.org/en/docs/stream/ngx_stream_js_module.html
+https://nginx.org/en/docs/njs/
+https://nginx.org/en/docs/http/ngx_http_js_module.html
+https://nginx.org/en/docs/stream/ngx_stream_js_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/debian/Makefile.module-opentracing b/debian/Makefile.module-opentracing
new file mode 100644
index 0000000..a7d6709
--- /dev/null
+++ b/debian/Makefile.module-opentracing
@@ -0,0 +1,92 @@
+MODULES+=	opentracing
+
+MODULE_SUMMARY_opentracing=	3rd-party OpenTracing dynamic module
+
+include $(CONTRIB)/src/opentracing-cpp/version
+include $(CONTRIB)/src/nginx-opentracing/version
+include $(CONTRIB)/src/jaeger-client-cpp/version
+
+MODULE_VERSION_opentracing=	$(NGINX_OPENTRACING_VERSION)
+MODULE_RELEASE_opentracing=	1
+
+MODULE_VERSION_PREFIX_opentracing=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_opentracing=	opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz \
+				nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz \
+				jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz
+
+MODULE_PATCHES_opentracing=	$(CONTRIB)/src/opentracing-cpp/CMakeLists.txt.patch \
+				$(CONTRIB)/src/jaeger-client-cpp/CMakeLists.txt.patch
+
+MODULE_CONFARGS_opentracing=	--add-dynamic-module=$(MODSRC_PREFIX)nginx-opentracing-$(NGINX_OPENTRACING_VERSION)/opentracing
+
+.deps-module-opentracing:
+	cd $(CONTRIB) && make \
+		.sum-opentracing-cpp \
+		.sum-nginx-opentracing \
+		.sum-jaeger-client-cpp
+	touch $@
+
+MODULE_BUILD_DEPENDS_opentracing=,cmake,libyaml-cpp-dev
+
+define MODULE_PREBUILD_opentracing
+	cd $$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION) \&\& \
+		mkdir .build \&\& \
+		cd .build \&\& \
+		cmake ../ \&\& \
+		DESTDIR=$$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION) $$(MAKE) -j$$(NUMJOBS) install
+	cd $$(BUILDDIR_nginx)/extra/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION) \&\& \
+		mkdir .build \&\& \
+		cd .build \&\& \
+		OpenTracing_DIR=$$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/.build cmake -DCMAKE_BUILD_TYPE=Release -DJAEGERTRACING_PLUGIN=ON -DHUNTER_CONFIGURATION_TYPES=Release -DBUILD_TESTING=OFF ../ -DOPENTRACING_INC=$$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include \&\& \
+		$$(MAKE) -j$$(NUMJOBS)
+endef
+export MODULE_PREBUILD_opentracing
+
+MODULE_CC_OPT_opentracing=-I$$\(BUILDDIR_nginx\)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include
+MODULE_CC_OPT_DEBUG_opentracing=$(MODULE_CC_OPT_opentracing)
+MODULE_LD_OPT_opentracing=-L$$\(BUILDDIR_nginx\)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib
+MODULE_LD_OPT_DEBUG_opentracing=$(MODULE_LD_OPT_opentracing)
+
+define MODULE_PREINSTALL_opentracing
+	mkdir -p $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)
+	install -m755 $$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing.so.$(OPENTRACING_CPP_VERSION) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)
+	ln -fs libopentracing.so.$(OPENTRACING_CPP_VERSION) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)/libopentracing.so.1
+	ln -fs libopentracing.so.1 $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)/libopentracing.so
+	install -m755 $$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)
+	ln -fs libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)/libopentracing_mocktracer.so.1
+	ln -fs libopentracing_mocktracer.so.1 $$(INSTALLDIR)/usr/lib/$$(DEB_HOST_MULTIARCH)/libopentracing_mocktracer.so
+	mkdir -p $$(INSTALLDIR)/usr/include
+	cp -pr $$(BUILDDIR_nginx)/extra/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include/opentracing $$(INSTALLDIR)/usr/include/
+	mkdir -p $$(INSTALLDIR)/usr/libexec/opentracing
+	install -m755 $$(BUILDDIR_nginx)/extra/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION)/.build/libjaegertracing_plugin.so $$(INSTALLDIR)/usr/libexec/opentracing/
+endef
+export MODULE_PREINSTALL_opentracing
+
+define MODULE_POST_opentracing
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_opentracing) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_opentracing_module.so;
+
+Note that additional tracer plugins are required in order
+to communicate with corresponding services (e.g. Zipkin, Jaeger).
+This package includes the Jaeger dynamic tracer plugin:
+
+    /usr/libexec/opentracing/libjaegertracing_plugin.so
+
+Please refer to the module documentation for further details:
+https://github.com/opentracing-contrib/nginx-opentracing
+https://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md
+
+OpenTracing project site (general info and documentation):
+https://opentracing.io/
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_opentracing
diff --git a/debian/Makefile.module-passenger b/debian/Makefile.module-passenger
new file mode 100644
index 0000000..907d3cd
--- /dev/null
+++ b/debian/Makefile.module-passenger
@@ -0,0 +1,41 @@
+MODULES+=	passenger
+
+MODULE_SUMMARY_passenger=	3rd-party Passenger dynamic module
+
+include $(CONTRIB)/src/passenger/version
+
+MODULE_VERSION_passenger=	$(PASSENGER_VERSION)
+MODULE_RELEASE_passenger=	1
+
+MODULE_VERSION_PREFIX_passenger=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_passenger=	passenger-$(PASSENGER_VERSION).tar.gz
+MODULE_PATCHES_passenger=	$(CONTRIB)/src/passenger/build-nginx.rb.patch \
+				$(CONTRIB)/src/passenger/src-nginx_module-ContentHandler.c.patch
+
+MODULE_CONFARGS_passenger=	--with-http_ssl_module \
+				--add-dynamic-module=$(MODSRC_PREFIX)passenger-$(PASSENGER_VERSION)/src/nginx_module
+
+.deps-module-passenger:
+	cd $(CONTRIB) && make .sum-passenger
+	touch $@
+
+MODULE_BUILD_DEPENDS_passenger=, rake
+
+define MODULE_POST_passenger
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_passenger) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_passenger_module.so;
+
+Please refer to the module documentation for further details:
+https://www.phusionpassenger.com/
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_passenger
diff --git a/debian/Makefile.module-perl b/debian/Makefile.module-perl
index 50dedfa..ce9c3ef 100644
--- a/debian/Makefile.module-perl
+++ b/debian/Makefile.module-perl
@@ -30,7 +30,7 @@
     load_module modules/ngx_http_perl_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_perl_module.html
+https://nginx.org/en/docs/http/ngx_http_perl_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/debian/Makefile.module-rtmp b/debian/Makefile.module-rtmp
new file mode 100644
index 0000000..8593852
--- /dev/null
+++ b/debian/Makefile.module-rtmp
@@ -0,0 +1,37 @@
+MODULES+=	rtmp
+
+MODULE_SUMMARY_rtmp=	3rd-party RTMP dynamic module
+
+include $(CONTRIB)/src/nginx-rtmp-module/version
+
+MODULE_VERSION_rtmp=	$(NGINX_RTMP_MODULE_VERSION)
+MODULE_RELEASE_rtmp=	1
+
+MODULE_VERSION_PREFIX_rtmp=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_rtmp=	nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION).tar.gz
+MODULE_PATCHES_rtmp=	$(CONTRIB)/src/nginx-rtmp-module/PR1340.patch
+
+MODULE_CONFARGS_rtmp=	--add-dynamic-module=$(MODSRC_PREFIX)nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION)
+
+.deps-module-rtmp:
+	cd $(CONTRIB) && make .sum-nginx-rtmp-module
+	touch $@
+
+define MODULE_POST_rtmp
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_rtmp) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_rtmp_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/arut/nginx-rtmp-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_rtmp
diff --git a/debian/Makefile.module-set-misc b/debian/Makefile.module-set-misc
new file mode 100644
index 0000000..de7799d
--- /dev/null
+++ b/debian/Makefile.module-set-misc
@@ -0,0 +1,53 @@
+MODULES+=	set-misc
+
+MODULE_SUMMARY_set_misc=	3rd-party set-misc dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/set-misc-nginx-module/version
+
+MODULE_VERSION_set_misc=	$(SET_MISC_NGINX_MODULE_VERSION)
+MODULE_RELEASE_set_misc=	1
+
+MODULE_VERSION_PREFIX_set_misc=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_set_misc=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+				set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_set_misc=	--with-http_ssl_module \
+				--add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+				--add-dynamic-module=$(MODSRC_PREFIX)set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION)
+
+.deps-module-set-misc:
+	cd $(CONTRIB) && make \
+		.sum-ngx_devel_kit \
+		.sum-set-misc-nginx-module
+	touch $@
+
+MODULE_DEPENDS_set_misc=,$(NDK_DEPENDENCY_TAG)
+
+define MODULE_PREINSTALL_set_misc
+	rm -f $$(BUILDDIR_nginx_debug)/objs/ndk_http_module-debug.so
+	rm -f $$(BUILDDIR_nginx)/objs/ndk_http_module.so
+endef
+export MODULE_PREINSTALL_set_misc
+
+define MODULE_POST_set_misc
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_set_misc) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_set_misc_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+Please refer to the module documentation for further details:
+https://github.com/openresty/set-misc-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_set_misc
diff --git a/debian/Makefile.module-subs-filter b/debian/Makefile.module-subs-filter
new file mode 100644
index 0000000..f73f85d
--- /dev/null
+++ b/debian/Makefile.module-subs-filter
@@ -0,0 +1,36 @@
+MODULES+=	subs-filter
+
+MODULE_SUMMARY_subs_filter=	3rd-party substitution dynamic module
+
+include $(CONTRIB)/src/ngx_http_substitutions_filter_module/version
+
+MODULE_VERSION_subs_filter=	$(SUBSTITUTIONS_FILTER_NGINX_MODULE_VERSION)
+MODULE_RELEASE_subs_filter=	1
+
+MODULE_VERSION_PREFIX_subs_filter=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_subs_filter=	ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH).tar.xz
+
+MODULE_CONFARGS_subs_filter=	--add-dynamic-module=$(MODSRC_PREFIX)ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH)
+
+.deps-module-subs-filter:
+	cd $(CONTRIB) && make .sum-ngx_http_substitutions_filter_module
+	touch $@
+
+define MODULE_POST_subs_filter
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_subs_filter) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_subs_filter_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/yaoweibin/ngx_http_substitutions_filter_module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_subs_filter
diff --git a/debian/Makefile.module-xslt b/debian/Makefile.module-xslt
index 5e655bb..2d6e00c 100644
--- a/debian/Makefile.module-xslt
+++ b/debian/Makefile.module-xslt
@@ -20,7 +20,7 @@
     load_module modules/ngx_http_xslt_filter_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_xslt_module.html
+https://nginx.org/en/docs/http/ngx_http_xslt_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/debian/extra/njs-0.5.0.tar.gz b/debian/extra/njs-0.5.0.tar.gz
deleted file mode 100644
index 688acfe..0000000
--- a/debian/extra/njs-0.5.0.tar.gz
+++ /dev/null
Binary files differ
diff --git a/debian/nginx-debug.service b/debian/nginx-debug.service
index af0bba4..5ae4759 100644
--- a/debian/nginx-debug.service
+++ b/debian/nginx-debug.service
@@ -1,6 +1,6 @@
 [Unit]
 Description=nginx - high performance web server
-Documentation=http://nginx.org/en/docs/
+Documentation=https://nginx.org/en/docs/
 After=network-online.target remote-fs.target nss-lookup.target
 Wants=network-online.target
 
diff --git a/debian/nginx.control.in b/debian/nginx.control.in
index 69a34cf..0474938 100644
--- a/debian/nginx.control.in
+++ b/debian/nginx.control.in
@@ -11,7 +11,7 @@
                libpcre3-dev,
                zlib1g-dev
 Standards-Version: 3.9.8.0
-Homepage: http://nginx.org
+Homepage: https://nginx.org
 
 Package: nginx
 Architecture: any
diff --git a/debian/nginx.preinst b/debian/nginx.preinst
index c18b83b..dc26ffb 100644
--- a/debian/nginx.preinst
+++ b/debian/nginx.preinst
@@ -32,14 +32,14 @@
 Thanks for using nginx!
 
 Please find the official documentation for nginx here:
-* http://nginx.org/en/docs/
+* https://nginx.org/en/docs/
 
 Please subscribe to nginx-announce mailing list to get
 the most important news about nginx:
-* http://nginx.org/en/support.html
+* https://nginx.org/en/support.html
 
 Commercial subscriptions for nginx are available on:
-* http://nginx.com/products/
+* https://nginx.com/products/
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/debian/nginx.service b/debian/nginx.service
index e509a2e..833aa45 100644
--- a/debian/nginx.service
+++ b/debian/nginx.service
@@ -1,6 +1,6 @@
 [Unit]
 Description=nginx - high performance web server
-Documentation=http://nginx.org/en/docs/
+Documentation=https://nginx.org/en/docs/
 After=network-online.target remote-fs.target nss-lookup.target
 Wants=network-online.target
 
diff --git a/docs/Makefile b/docs/Makefile
index 244c64c..b3e5ffb 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -5,10 +5,22 @@
 XSLS?=	xslscript.pl
 
 PACKAGES=	nginx							\
+		nginx-module-brotli					\
+		nginx-module-encrypted-session				\
 		nginx-module-geoip					\
+		nginx-module-geoip2					\
+		nginx-module-headers-more				\
 		nginx-module-image-filter				\
+		nginx-module-lua					\
+		nginx-module-modsecurity				\
+		nginx-module-ndk					\
 		nginx-module-njs					\
+		nginx-module-opentracing				\
+		nginx-module-passenger					\
 		nginx-module-perl					\
+		nginx-module-rtmp					\
+		nginx-module-set-misc					\
+		nginx-module-subs-filter				\
 		nginx-module-xslt
 
 all:		changes changelogs
diff --git a/docs/nginx-module-brotli.copyright b/docs/nginx-module-brotli.copyright
new file mode 100644
index 0000000..d07af3b
--- /dev/null
+++ b/docs/nginx-module-brotli.copyright
@@ -0,0 +1,25 @@
+Copyright (C) 2002-2015 Igor Sysoev
+Copyright (C) 2011-2015 Nginx, Inc.
+Copyright (C) 2015 Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/docs/nginx-module-brotli.xml b/docs/nginx-module-brotli.xml
new file mode 100644
index 0000000..03e893d
--- /dev/null
+++ b/docs/nginx-module-brotli.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_brotli">
+
+
+<changes apply="nginx-module-brotli" ver="1.0.0" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of brotli nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-encrypted-session.copyright b/docs/nginx-module-encrypted-session.copyright
new file mode 100644
index 0000000..0f8e413
--- /dev/null
+++ b/docs/nginx-module-encrypted-session.copyright
@@ -0,0 +1,25 @@
+Copyright (c) 2009-2018, Yichun Zhang (agentzh) <agentzh@gmail.com>, OpenResty Inc.
+
+This module is licensed under the terms of the BSD license.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-encrypted-session.xml b/docs/nginx-module-encrypted-session.xml
new file mode 100644
index 0000000..f0bfb7d
--- /dev/null
+++ b/docs/nginx-module-encrypted-session.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_encrypted_session">
+
+
+<changes apply="nginx-module-encrypted-session" ver="0.08" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of encrypted session nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-geoip2.copyright b/docs/nginx-module-geoip2.copyright
new file mode 100644
index 0000000..fdc13a7
--- /dev/null
+++ b/docs/nginx-module-geoip2.copyright
@@ -0,0 +1,23 @@
+Copyright (c) 2014, Lee Valentine <lee@leev.net>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-geoip2.xml b/docs/nginx-module-geoip2.xml
new file mode 100644
index 0000000..9a29a4f
--- /dev/null
+++ b/docs/nginx-module-geoip2.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_geoip2">
+
+
+<changes apply="nginx-module-geoip2" ver="3.3" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of geoip2 nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-headers-more.copyright b/docs/nginx-module-headers-more.copyright
new file mode 100644
index 0000000..a787148
--- /dev/null
+++ b/docs/nginx-module-headers-more.copyright
@@ -0,0 +1,30 @@
+The code base is borrowed directly from the standard headers module
+in Nginx 0.8.24. This part of code is copyrighted by Igor Sysoev.
+
+Copyright (c) 2009-2017, Yichun "agentzh" Zhang (章亦春) agentzh@gmail.com, OpenResty Inc.
+Copyright (c) 2010-2013, Bernd Dorn.
+
+This module is licensed under the terms of the BSD license.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-headers-more.xml b/docs/nginx-module-headers-more.xml
new file mode 100644
index 0000000..7be47e1
--- /dev/null
+++ b/docs/nginx-module-headers-more.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_headers_more">
+
+
+<changes apply="nginx-module-headers-more" ver="0.33" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of headers more nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-lua.copyright b/docs/nginx-module-lua.copyright
new file mode 100644
index 0000000..cd2c396
--- /dev/null
+++ b/docs/nginx-module-lua.copyright
@@ -0,0 +1,151 @@
+This module is licensed under the BSD license.
+
+Copyright (C) 2009-2017, by Xiaozhe Wang (chaoslawful) chaoslawful@gmail.com.
+Copyright (C) 2009-2019, by Yichun "agentzh" Zhang (章亦春) agentzh@gmail.com, OpenResty Inc.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+===============================================================================
+Includes LuaJIT with the following license:
+
+LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
+
+Copyright (C) 2005-2017 Mike Pall. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+[ MIT license: http://www.opensource.org/licenses/mit-license.php ]
+
+===============================================================================
+[ LuaJIT includes code from Lua 5.1/5.2, which has this license statement: ]
+
+Copyright (C) 1994-2012 Lua.org, PUC-Rio.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+===============================================================================
+[ LuaJIT includes code from dlmalloc, which has this license statement: ]
+
+This is a version (aka dlmalloc) of malloc/free/realloc written by
+Doug Lea and released to the public domain, as explained at
+http://creativecommons.org/licenses/publicdomain
+
+===============================================================================
+Includes lua-resty-core with the following license:
+
+This module is licensed under the BSD license.
+
+Copyright (C) 2013-2019, by Yichun "agentzh" Zhang, OpenResty Inc.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+===============================================================================
+Includes lua-resty-lrucache with the following license:
+
+This module is licensed under the BSD license.
+
+Copyright (C) 2014-2019, by Yichun "agentzh" Zhang, OpenResty Inc.
+Copyright (C) 2014-2017, by Shuxin Yang.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-lua.xml b/docs/nginx-module-lua.xml
new file mode 100644
index 0000000..a4f8c21
--- /dev/null
+++ b/docs/nginx-module-lua.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_lua">
+
+
+<changes apply="nginx-module-lua" ver="0.10.19" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of Lua nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-modsecurity.copyright b/docs/nginx-module-modsecurity.copyright
new file mode 100644
index 0000000..b040295
--- /dev/null
+++ b/docs/nginx-module-modsecurity.copyright
@@ -0,0 +1,73 @@
+
+ModSecurity, http://www.modsecurity.org/
+Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+Includes the libinjection library distributed under the following license:
+
+/*
+ * Copyright 2012, 2013, 2014
+ * Nick Galbreath -- nickg [at] client9 [dot] com
+ * http://www.client9.com/projects/libinjection/
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *   Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ *   Neither the name of libinjection nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This is the standard "new" BSD license:
+ * http://www.opensource.org/licenses/bsd-license.php
+ */
+
+
+Includes the YAJL library distributed under the following license:
+
+Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/docs/nginx-module-modsecurity.xml b/docs/nginx-module-modsecurity.xml
new file mode 100644
index 0000000..884f989
--- /dev/null
+++ b/docs/nginx-module-modsecurity.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_modsecurity">
+
+
+<changes apply="nginx-module-modsecurity" ver="1.0.1" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of ModSecurity nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-ndk.copyright b/docs/nginx-module-ndk.copyright
new file mode 100644
index 0000000..973d39e
--- /dev/null
+++ b/docs/nginx-module-ndk.copyright
@@ -0,0 +1,29 @@
+Copyright (c) 2010-2018, Marcus Clyne
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-ndk.xml b/docs/nginx-module-ndk.xml
new file mode 100644
index 0000000..5114028
--- /dev/null
+++ b/docs/nginx-module-ndk.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_ndk">
+
+
+<changes apply="nginx-module-ndk" ver="0.3.1" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of nginx devel kit module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-opentracing.copyright b/docs/nginx-module-opentracing.copyright
new file mode 100644
index 0000000..8dada3e
--- /dev/null
+++ b/docs/nginx-module-opentracing.copyright
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/docs/nginx-module-opentracing.xml b/docs/nginx-module-opentracing.xml
new file mode 100644
index 0000000..4444f6d
--- /dev/null
+++ b/docs/nginx-module-opentracing.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_opentracing">
+
+
+<changes apply="nginx-module-opentracing" ver="0.10.0" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of OpenTracing nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-passenger.copyright b/docs/nginx-module-passenger.copyright
new file mode 100644
index 0000000..aa2c62c
--- /dev/null
+++ b/docs/nginx-module-passenger.copyright
@@ -0,0 +1,19 @@
+Copyright (c) 2010-2017 Phusion Holding B.V.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/docs/nginx-module-passenger.xml b/docs/nginx-module-passenger.xml
new file mode 100644
index 0000000..565ffa5
--- /dev/null
+++ b/docs/nginx-module-passenger.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_passenger">
+
+
+<changes apply="nginx-module-passenger" ver="6.0.6" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of Passenger nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-rtmp.copyright b/docs/nginx-module-rtmp.copyright
new file mode 100644
index 0000000..15cb1e0
--- /dev/null
+++ b/docs/nginx-module-rtmp.copyright
@@ -0,0 +1,22 @@
+Copyright (c) 2012-2014, Roman Arutyunyan
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-rtmp.xml b/docs/nginx-module-rtmp.xml
new file mode 100644
index 0000000..55cb23f
--- /dev/null
+++ b/docs/nginx-module-rtmp.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_rtmp">
+
+
+<changes apply="nginx-module-rtmp" ver="1.2.1" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of RTMP nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-set-misc.copyright b/docs/nginx-module-set-misc.copyright
new file mode 100644
index 0000000..e54a086
--- /dev/null
+++ b/docs/nginx-module-set-misc.copyright
@@ -0,0 +1,26 @@
+Copyright (C) 2009-2018, Yichun Zhang (章亦春) <agentzh@gmail.com>, OpenResty Inc.
+
+This module is licensed under the terms of the BSD license.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-set-misc.xml b/docs/nginx-module-set-misc.xml
new file mode 100644
index 0000000..1f8b43e
--- /dev/null
+++ b/docs/nginx-module-set-misc.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_set_misc">
+
+
+<changes apply="nginx-module-set-misc" ver="0.32" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of set misc nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/docs/nginx-module-subs-filter.copyright b/docs/nginx-module-subs-filter.copyright
new file mode 100644
index 0000000..2c59504
--- /dev/null
+++ b/docs/nginx-module-subs-filter.copyright
@@ -0,0 +1,28 @@
+This module is licensed under the BSD license.
+
+Copyright (C) 2014 by Weibin Yao <yaoweibin@gmail.com>.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/nginx-module-subs-filter.xml b/docs/nginx-module-subs-filter.xml
new file mode 100644
index 0000000..fab0ad3
--- /dev/null
+++ b/docs/nginx-module-subs-filter.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<!DOCTYPE change_log SYSTEM "changes.dtd" >
+
+
+<change_log title="nginx_module_subs_filter">
+
+
+<changes apply="nginx-module-subs-filter" ver="0.6.4" rev="1" basever="1.19.6"
+         date="2020-12-17" time="12:00:00 +0300"
+         packager="Andrei Belov &lt;defanator@gmail.com&gt;">
+
+<change>
+<para>
+Initial release of subs filter nginx module package.
+</para>
+</change>
+
+</changes>
+
+
+</change_log>
diff --git a/rpm/SOURCES/njs-0.5.0.tar.gz b/rpm/SOURCES/njs-0.5.0.tar.gz
deleted file mode 100644
index 688acfe..0000000
--- a/rpm/SOURCES/njs-0.5.0.tar.gz
+++ /dev/null
Binary files differ
diff --git a/rpm/SPECS/Makefile b/rpm/SPECS/Makefile
index 515e947..8452a14 100644
--- a/rpm/SPECS/Makefile
+++ b/rpm/SPECS/Makefile
@@ -8,9 +8,10 @@
 BUILD_ENV_PATH=	${HOME}/rpmbuild
 MODULE_TARGET?=	oss
 MODSRC_PREFIX=
-MODSRC_PATH=	$(SRCPATH)
 BUILD_DIR=	%{bdir}
 DOCS?=		../../docs
+CONTRIB?=	../../contrib
+CONTRIB:=	$(abspath $(CONTRIB))
 
 ifeq ($(MODULE_TARGET), plus)
 MODULE_SPEC_TEMPLATE=	nginx-plus-module.spec.in
@@ -27,9 +28,11 @@
 MODULE_TARGET_PREFIX=$(TARGET_VERSION)+
 
 MODULE_PACKAGE_VENDOR=	Nginx, Inc.
-MODULE_PACKAGE_URL=	http://nginx.org/
+MODULE_PACKAGE_URL=	https://nginx.org/
 MODULE_PACKAGE_LICENSE=2-clause BSD-like license
 
+BASE_MODULES=	geoip image-filter njs perl xslt
+
 MODULES=
 
 -include Makefile.module-*
@@ -77,23 +80,35 @@
 
 export CR=\\n
 
-modname = $(shell echo $1 | cut -c 14- | cut -d '.' -f 1 | tr '-' '_')
+modname = $(shell echo $1 | tr '-' '_')
 
 default:
 	@echo "valid targets: all base $(addprefix module-, $(MODULES)) test test-debug"
 
-all:	base modules
+list-base:
+	@printf "%-20s\t%s\n" nginx $(BASE_VERSION)-$(BASE_RELEASE)
+
+list-module-%:
+	@printf "%-20s\t%s\n" $* $(MODULE_VERSION_$(call modname, $*))-$(MODULE_RELEASE_$(call modname, $*))
+
+list-all-modules: $(addprefix list-module-, $(MODULES))
+
+list-base-modules: $(addprefix list-module-, $(BASE_MODULES))
+
+list: list-base list-all-modules
+
+all:	base base-modules
 	@echo "===> all done"
 
+base-modules:	$(addprefix module-, $(BASE_MODULES))
+
 modules:	$(addprefix module-, $(MODULES))
 
 specs:	nginx.spec $(addsuffix .spec, $(addprefix nginx-module-, $(MODULES)))
 
-$(BASE_SRC):
-	wget http://nginx.org/download/$(BASE_SRC)
-
 $(SRCPATH)/$(BASE_SRC):
-	@cd $(SRCPATH) && wget http://nginx.org/download/$(BASE_SRC)
+	cd $(CONTRIB) && make .sum-nginx
+	cd $(SRCPATH) && ln -s $(CONTRIB)/tarballs/$(BASE_SRC) $(BASE_SRC)
 
 base:	nginx.spec $(SRCPATH)/$(BASE_SRC)
 	@echo "===> Building base package" ; \
@@ -120,7 +135,10 @@
 	cp -p $(DOCS)/nginx.copyright ../SOURCES/ ; \
 	}
 
-module-%: nginx-module-%.spec check-compat-% $(SRCPATH)/$(BASE_SRC)
+.deps-module-%:
+	touch $@
+
+module-%: nginx-module-%.spec check-compat-% $(SRCPATH)/$(BASE_SRC) .deps-module-%
 	@if [ -e nginx-$@.skip ]; then \
 	    echo "---> Skipping nginx-$@ package (`cat nginx-$@.skip`)" ; \
 	else \
@@ -140,19 +158,42 @@
 	i=100 ; \
 	sources= ; \
 	prepsources= ; \
-	for src in $(MODULE_SOURCES_$(call modname, $@)); do \
+	for src in $(MODULE_SOURCES_$(call modname, $*)); do \
+		if [ -h ../SOURCES/$${src} ] ; then rm ../SOURCES/$${src} ; fi ; \
+		ln -s $(CONTRIB)/tarballs/$${src} ../SOURCES/$${src} ; \
 		s="`printf "Source%d: %s\n" $${i} $${src}`" ; \
 		sources="$${sources}\n$${s}" ; \
-		s="`printf "tar zxf %%{SOURCE%d\}" $${i}`" ; \
+		case "$${src}" in \
+			*.tar.xz) \
+				taropts="xvJfo" ; \
+				;; \
+			*) \
+				taropts="xvzfo" ; \
+				;; \
+		esac ; \
+		s="`printf "tar $${taropts} %%{SOURCE%d\}" $${i}`" ; \
+		prepsources="$${prepsources}\n$${s}" ; \
+		sn=`echo $${src} | sed -e 's/-[0-9].*$$//'` ; \
+		if [ "$${sn}" = "$${src}" ] ; then \
+			sn=$${src%-*} ; \
+		fi ; \
+		s="`printf "ln -s $${sn}-* $${sn}"`" ; \
 		prepsources="$${prepsources}\n$${s}" ; \
 		i=$$(($${i}+1)) ; \
 	done ; \
 	i=100 ; \
 	patches= ; \
 	preppatches= ; \
-	for src in $(MODULE_PATCHES_$(call modname, $@)); do \
-		s="`printf "Patch%d: %s\n" $${i} $${src}`" ; \
+	for src in $(MODULE_PATCHES_$(call modname, $*)); do \
+		dn=`dirname $${src}` ; \
+		bdn=`basename $${dn}` ; \
+		pn="$${bdn}_`basename $${src}`" ; \
+		if [ -h ../SOURCES/$${pn} ] ; then rm ../SOURCES/$${pn} ; fi ; \
+		ln -s $${src} ../SOURCES/$${pn} ; \
+		s="`printf "Patch%d: %s\n" $${i} $${pn}`" ; \
 		patches="$${patches}\n$${s}" ; \
+		s="`printf "cd %%{bdir}/$${bdn}"`" ; \
+		preppatches="$${preppatches}\n$${s}" ; \
 		s="`printf "%%patch%d -p1" $${i}`" ; \
 		preppatches="$${preppatches}\n$${s}" ; \
 		i=$$(($${i}+1)) ; \
@@ -163,28 +204,28 @@
 	if [ "$(MODULE_TARGET)" = "plus" ]; then \
 		pkgname=`echo $${pkgname} | sed -e "s#^nginx-#nginx-plus-#"` ; \
 	fi ; \
-	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	buildenv=`echo "$$MODULE_ENV_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	files=`echo "$$MODULE_FILES_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
-	post=`echo "$$MODULE_POST_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	buildenv=`echo "$$MODULE_ENV_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	files=`echo "$$MODULE_FILES_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	post=`echo "$$MODULE_POST_$(call modname, $*)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
 	cat $(MODULE_SPEC_TEMPLATE) | sed \
 		-e "s#%%NAME%%#$${pkgname}#g" \
 		-e "s#%%MODULE_PACKAGE_VENDOR%%#$(MODULE_PACKAGE_VENDOR)#g" \
 		-e "s#%%MODULE_PACKAGE_URL%%#$(MODULE_PACKAGE_URL)#g" \
 		-e "s#%%MODULE_PACKAGE_LICENSE%%#$(MODULE_PACKAGE_LICENSE)#g" \
-		-e "s#%%SUMMARY%%#$(MODULE_SUMMARY_PREFIX) $(MODULE_SUMMARY_$(call modname, $@))#g" \
-		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $@))#g" \
+		-e "s#%%SUMMARY%%#$(MODULE_SUMMARY_PREFIX) $(MODULE_SUMMARY_$(call modname, $*))#g" \
+		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $*))#g" \
 		-e "s#%%TARGET_VERSION%%#$(TARGET_VERSION)#g" \
 		-e "s#%%BASE_VERSION%%#$(BASE_VERSION)#g" \
 		-e "s#%%BASE_RELEASE%%#$(BASE_RELEASE)#g" \
 		-e "s#%%PLUS_VERSION%%#$(PLUS_VERSION)#g" \
-		-e "s#%%VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $@))#g" \
-		-e "s#%%VERSION%%#$(MODULE_VERSION_$(call modname, $@))#g" \
-		-e "s#%%RELEASE%%#$(MODULE_RELEASE_$(call modname, $@))#g" \
+		-e "s#%%VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $*))#g" \
+		-e "s#%%VERSION%%#$(MODULE_VERSION_$(call modname, $*))#g" \
+		-e "s#%%RELEASE%%#$(MODULE_RELEASE_$(call modname, $*))#g" \
 		-e "s#%%BASE_CONFIGURE_ARGS%%#$(BASE_CONFIGURE_ARGS)#g" \
-		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $@))#g" \
+		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $*))#g" \
 		-e "s#%%COPYRIGHT_SOURCE%%#$${module_copyright}#g" \
 		-e "s#%%MODULE_SOURCES%%#$${sources}#g" \
 		-e "s#%%MODULE_PATCHES%%#$${patches}#g" \
@@ -193,10 +234,10 @@
 		-e "s#%%MODULE_DEFINITIONS%%#$${definitions}#g" \
 		-e "s#%%MODULE_PREBUILD%%#$${prebuild}#g" \
 		-e "s#%%MODULE_ENV%%#$${buildenv}#g" \
-		-e "s#%%MODULE_CC_OPT%%#$(MODULE_CC_OPT_$(call modname, $@))#g" \
-		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $@))#g" \
-		-e "s#%%MODULE_LD_OPT%%#$(MODULE_LD_OPT_$(call modname, $@))#g" \
-		-e "s#%%MODULE_LD_OPT_DEBUG%%#$(MODULE_LD_OPT_DEBUG_$(call modname, $@))#g" \
+		-e "s#%%MODULE_CC_OPT%%#$(MODULE_CC_OPT_$(call modname, $*))#g" \
+		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $*))#g" \
+		-e "s#%%MODULE_LD_OPT%%#$(MODULE_LD_OPT_$(call modname, $*))#g" \
+		-e "s#%%MODULE_LD_OPT_DEBUG%%#$(MODULE_LD_OPT_DEBUG_$(call modname, $*))#g" \
 		-e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \
 		-e "s#%%MODULE_FILES%%#$${files}#g" \
 		-e "s#%%MODULE_POST%%#$${post}#g" \
@@ -205,8 +246,8 @@
 		-e 's#%%TARGET_VERSION%%#$(TARGET_VERSION)#g' \
 		-e 's#%%BASE_VERSION%%#$(BASE_VERSION)#g' \
 		-e 's#%%BASE_RELEASE%%#$(BASE_RELEASE)#g' \
-		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $@))#g" \
-		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $@))#g" \
+		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $*))#g" \
+		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $*))#g" \
 		>> $@.tmp && \
 	mv $@.tmp $@ ; \
 	}
@@ -230,7 +271,7 @@
 		cp -rP ../nginx-tests nginx-tests ; \
 	else \
 		echo "===> Cloning tests" ; \
-		hg clone http://hg.nginx.org/nginx-tests ; \
+		hg clone https://hg.nginx.org/nginx-tests ; \
 	fi ; \
 	}
 
@@ -239,6 +280,8 @@
 	@{ \
 	pwd=`pwd` ; \
 	globals= ; \
+	globals_http= ; \
+	globals_stream= ; \
 	for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \
 		globals="$$globals load_module $$pwd/$$so;" ; \
 	done ; \
@@ -248,7 +291,11 @@
 	if [ -d $$pwd/module-opentracing ]; then \
 		export LD_LIBRARY_PATH=$$pwd/module-opentracing/../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib ; \
 	fi ;  \
-	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove . ; \
+	if [ -d $$pwd/module-lua ]; then \
+		globals_http="lua_package_path '$$pwd/../BUILD/nginx-module-lua-$(BASE_VERSION)/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/../BUILD/nginx-module-lua-$(BASE_VERSION)/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \
+		globals_stream="$$globals_http" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \
 	}
 
 test-debug: base nginx-tests
@@ -256,6 +303,8 @@
 	@{ \
 	pwd=`pwd` ; \
 	globals= ; \
+	globals_http= ; \
+	globals_stream= ; \
 	for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \
 		globals="$$globals load_module $$pwd/$$so;" ; \
 	done ; \
@@ -265,34 +314,33 @@
 	if [ -d $$pwd/module-opentracing ]; then \
 		export LD_LIBRARY_PATH=$$pwd/module-opentracing/../opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib ; \
 	fi ;  \
-	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" prove . ; \
+	if [ -d $$pwd/module-lua ]; then \
+		globals_http="lua_package_path '$$pwd/../BUILD/nginx-module-lua-$(BASE_VERSION)/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/../BUILD/nginx-module-lua-$(BASE_VERSION)/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \
+		globals_stream="$$globals_http" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \
 	}
 
-prepare-build-env: $(BASE_SRC)
+test-modules: $(addprefix test-module-, $(MODULES))
+
+test-module-%: base nginx-tests module-%
 	@{ \
-	set -e ; \
-	cwd=`pwd` ; \
-	case $$cwd in $(BUILD_ENV_PATH)*) \
-		echo "You are in $(BUILD_ENV_PATH), skipping" >&2 ; \
-		exit 1 ; \
-	esac ; \
-	if [ -e $(BUILD_ENV_PATH) ]; then \
-		echo "$(BUILD_ENV_PATH) is already exists and going to be removed." ; \
-		echo "Press Enter to continue or Ctrl+C to exit" ; \
-		read ; \
-		rm -rf $(BUILD_ENV_PATH) ; \
+	module=`echo $@ | cut -d '-' -f 3-` ; \
+	testdir="$(MODULE_TESTS_$(shell echo $@ | cut -d '-' -f 3-))" ; \
+	if [ -z "$$testdir" ]; then \
+		echo "---> Skipping, no tests defined for $$module module" ; \
+		exit 0 ; \
 	fi ; \
-	mkdir -p $(BUILD_ENV_PATH) ; \
-	pd=`dirname $${cwd}` ; \
-	cp -rP $${pd}/SPECS $(BUILD_ENV_PATH)/ ; \
-	cp -rP $${pd}/SOURCES $(BUILD_ENV_PATH)/ ; \
-	cp $(BASE_SRC) $(BUILD_ENV_PATH)/SOURCES/ ; \
-	cp -pr $(DOCS) $(BUILD_ENV_PATH); \
-	echo "Build environment has been created in: $(BUILD_ENV_PATH)" ; \
-	echo ; \
-	echo "Please do the following in order to get available build targets:" ; \
-	echo "    cd $(BUILD_ENV_PATH)/SPECS" ; \
-	echo "    make" ; \
+	pwd=`pwd` ; \
+	globals= ; \
+	for so in `find module-$${module}/ -maxdepth 1 -type f -name "*module.so"`; do \
+		globals="$$globals load_module $$pwd/$$so;" ; \
+	done ; \
+	if [ ! -d nginx-tests/module-$${module} ]; then \
+		cp -r $${pwd}/module-$${module}/../$${testdir} nginx-tests/module-$${module} ; \
+		ln -fs ../lib nginx-tests/module-$${module}/lib ; \
+	fi ; \
+	cd nginx-tests/module-$${module} && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
 	}
 
 clean:
@@ -301,7 +349,9 @@
 	@rm -rf nginx-tests
 	@rm -f $(BASE_SRC) $(SRCPATH)/$(BASE_SRC)
 	@rm -f nginx.rpm-changelog nginx-module-*.rpm-changelog
+	@rm -f .deps-module-*
+	@find ../SOURCES/ -type l -delete
 
-.PHONY:	default all modules specs test test-debug clean
+.PHONY:	default list list-base list-all-modules list-base-modules all modules specs test test-debug clean
 
 .SECONDARY:
diff --git a/rpm/SPECS/Makefile.module-brotli b/rpm/SPECS/Makefile.module-brotli
new file mode 100644
index 0000000..6e28d69
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-brotli
@@ -0,0 +1,46 @@
+MODULES+=	brotli
+
+MODULE_SUMMARY_brotli=	3rd-party brotli compression dynamic modules
+
+include $(CONTRIB)/src/ngx_brotli/version
+
+MODULE_VERSION_brotli=	$(NGX_BROTLI_VERSION)
+MODULE_RELEASE_brotli=	1
+
+MODULE_VERSION_PREFIX_brotli=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_brotli=	ngx_brotli-$(NGX_BROTLI_VERSION).tar.gz
+
+MODULE_CONFARGS_brotli=	--add-dynamic-module=ngx_brotli-$(NGX_BROTLI_VERSION)rc
+
+.deps-module-brotli:
+	cd $(CONTRIB) && make .sum-ngx_brotli
+	touch $@
+
+define MODULE_DEFINITIONS_brotli
+%if 0%{?suse_version} == 0
+BuildRequires: brotli-devel
+%else
+BuildRequires: libbrotli-devel
+%endif
+endef
+export MODULE_DEFINITIONS_brotli
+
+define MODULE_POST_brotli
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_brotli) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_brotli_filter_module.so;
+    load_module modules/ngx_http_brotli_static_module.so;
+
+Please refer to the modules documentation for further details:
+https://github.com/google/ngx_brotli
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_brotli
diff --git a/rpm/SPECS/Makefile.module-encrypted-session b/rpm/SPECS/Makefile.module-encrypted-session
new file mode 100644
index 0000000..a1895fe
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-encrypted-session
@@ -0,0 +1,54 @@
+MODULES+=	encrypted-session
+
+MODULE_SUMMARY_encrypted_session=	3rd-party encrypted session dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/encrypted-session-nginx-module/version
+
+MODULE_VERSION_encrypted_session=	$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION)
+MODULE_RELEASE_encrypted_session=	1
+
+MODULE_VERSION_PREFIX_encrypted_session=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_encrypted_session=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+					encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_encrypted_session=	--add-dynamic-module=ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+					--add-dynamic-module=encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION)
+
+.deps-module-encrypted-session:
+	cd $(CONTRIB) && make \
+		.sum-ngx_devel_kit \
+		.sum-encrypted-session-nginx-module
+	touch $@
+
+define MODULE_DEFINITIONS_encrypted_session
+Requires: $(NDK_DEPENDENCY_TAG)
+endef
+export MODULE_DEFINITIONS_encrypted_session
+
+define MODULE_PREINSTALL_encrypted_session
+%{__rm} -f %{bdir}/objs/ndk_http_module.so %{bdir}/objs/ndk_http_module-debug.so
+endef
+export MODULE_PREINSTALL_encrypted_session
+
+define MODULE_POST_encrypted_session
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_encrypted_session) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_encrypted_session_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+Please refer to the modules documentation for further details:
+https://github.com/openresty/encrypted-session-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_encrypted_session
diff --git a/rpm/SPECS/Makefile.module-geoip b/rpm/SPECS/Makefile.module-geoip
index 4ff160d..04beadb 100644
--- a/rpm/SPECS/Makefile.module-geoip
+++ b/rpm/SPECS/Makefile.module-geoip
@@ -11,10 +11,8 @@
 define MODULE_DEFINITIONS_geoip
 %if 0%{?suse_version} >= 1315
 BuildRequires: libGeoIP-devel
-Requires: libGeoIP1
 %else
 BuildRequires: GeoIP-devel
-Requires: GeoIP
 %endif
 endef
 export MODULE_DEFINITIONS_geoip
@@ -31,8 +29,8 @@
     load_module modules/ngx_stream_geoip_module.so;
 
 Please refer to the modules documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_geoip_module.html
-http://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
+https://nginx.org/en/docs/http/ngx_http_geoip_module.html
+https://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/rpm/SPECS/Makefile.module-geoip2 b/rpm/SPECS/Makefile.module-geoip2
new file mode 100644
index 0000000..d31a252
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-geoip2
@@ -0,0 +1,43 @@
+MODULES+=	geoip2
+
+MODULE_SUMMARY_geoip2=	3rd-party GeoIP2 dynamic modules
+
+include $(CONTRIB)/src/ngx_http_geoip2_module/version
+
+MODULE_VERSION_geoip2=	$(GEOIP2_NGINX_MODULE_VERSION)
+MODULE_RELEASE_geoip2=	1
+
+MODULE_VERSION_PREFIX_geoip2=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_geoip2=	ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_geoip2=	--with-stream \
+			--add-dynamic-module=ngx_http_geoip2_module-$(GEOIP2_NGINX_MODULE_VERSION)
+
+.deps-module-geoip2:
+	cd $(CONTRIB) && make .sum-ngx_http_geoip2_module
+	touch $@
+
+define MODULE_DEFINITIONS_geoip2
+BuildRequires: libmaxminddb-devel
+endef
+export MODULE_DEFINITIONS_geoip2
+
+define MODULE_POST_geoip2
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_geoip2) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_geoip2_module.so;
+    load_module modules/ngx_stream_geoip2_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/leev/ngx_http_geoip2_module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_geoip2
diff --git a/rpm/SPECS/Makefile.module-headers-more b/rpm/SPECS/Makefile.module-headers-more
new file mode 100644
index 0000000..8316522
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-headers-more
@@ -0,0 +1,38 @@
+MODULES+=	headers-more
+
+MODULE_SUMMARY_headers_more=	3rd-party headers-more dynamic module
+
+include $(CONTRIB)/src/headers-more-nginx-module/version
+
+MODULE_VERSION_headers_more=	$(HEADERS_MORE_NGINX_MODULE_VERSION)
+MODULE_RELEASE_headers_more=	1
+
+MODULE_VERSION_PREFIX_headers_more=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_headers_more=	headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_headers_more=	--with-http_dav_module \
+				--with-http_realip_module \
+				--add-dynamic-module=headers-more-nginx-module-$(HEADERS_MORE_NGINX_MODULE_VERSION)
+
+.deps-module-headers-more:
+	cd $(CONTRIB) && make .sum-headers-more-nginx-module
+	touch $@
+
+define MODULE_POST_headers_more
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_headers_more) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_headers_more_filter_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/openresty/headers-more-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_headers_more
diff --git a/rpm/SPECS/Makefile.module-image-filter b/rpm/SPECS/Makefile.module-image-filter
index 6f92860..d53e312 100644
--- a/rpm/SPECS/Makefile.module-image-filter
+++ b/rpm/SPECS/Makefile.module-image-filter
@@ -9,7 +9,6 @@
 
 define MODULE_DEFINITIONS_image_filter
 BuildRequires: gd-devel
-Requires: gd
 endef
 export MODULE_DEFINITIONS_image_filter
 
@@ -24,7 +23,7 @@
     load_module modules/ngx_http_image_filter_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_image_filter_module.html
+https://nginx.org/en/docs/http/ngx_http_image_filter_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/rpm/SPECS/Makefile.module-lua b/rpm/SPECS/Makefile.module-lua
new file mode 100644
index 0000000..3cc7041
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-lua
@@ -0,0 +1,129 @@
+MODULES+=	lua
+
+MODULE_SUMMARY_lua=	3rd-party Lua dynamic modules
+
+include $(CONTRIB)/src/luajit2/version
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/lua-nginx-module/version
+include $(CONTRIB)/src/stream-lua-nginx-module/version
+include $(CONTRIB)/src/lua-resty-core/version
+include $(CONTRIB)/src/lua-resty-lrucache/version
+
+MODULE_VERSION_lua=	$(LUA_NGINX_MODULE_VERSION)
+MODULE_RELEASE_lua=	1
+
+MODULE_VERSION_PREFIX_lua=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_lua=	luajit2-$(LUAJIT2_VERSION).tar.gz \
+			ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+			lua-nginx-module-$(LUA_NGINX_MODULE_VERSION).tar.gz \
+			stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION).tar.gz \
+			lua-resty-core-$(LUA_RESTY_CORE_VERSION).tar.gz \
+			lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION).tar.gz
+
+MODULE_PATCHES_lua=	$(CONTRIB)/src/luajit2/Makefile.patch \
+			$(CONTRIB)/src/luajit2/src-luaconf.h.patch \
+			$(CONTRIB)/src/lua-nginx-module/config.patch \
+			$(CONTRIB)/src/stream-lua-nginx-module/config.patch
+
+MODULE_CONFARGS_lua=	--with-http_dav_module \
+			--with-http_realip_module \
+			--with-http_ssl_module \
+			--with-http_v2_module \
+			--with-stream \
+			--with-stream_ssl_module \
+			--add-dynamic-module=ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+			--add-dynamic-module=lua-nginx-module-$(LUA_NGINX_MODULE_VERSION) \
+			--add-dynamic-module=stream-lua-nginx-module-$(STREAM_LUA_NGINX_MODULE_VERSION)
+
+.deps-module-lua:
+	cd $(CONTRIB) && make \
+		.sum-luajit2 \
+		.sum-ngx_devel_kit \
+		.sum-lua-nginx-module \
+		.sum-stream-lua-nginx-module \
+		.sum-lua-resty-core \
+		.sum-lua-resty-lrucache
+	touch $@
+
+define MODULE_DEFINITIONS_lua
+Requires: $(NDK_DEPENDENCY_TAG)
+%define LUAJIT_INC %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1
+%define LUAJIT_LIB %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/lib
+endef
+export MODULE_DEFINITIONS_lua
+
+define MODULE_PREBUILD_lua
+cd %{bdir}/luajit2-$(LUAJIT2_VERSION)
+DESTDIR="%{bdir}/luajit2-$(LUAJIT2_VERSION)" CFLAGS="-fPIC" make %{?_smp_mflags} install
+mv %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/bin/luajit %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/bin/nginx-luajit
+endef
+export MODULE_PREBUILD_lua
+
+define MODULE_ENV_lua
+LUAJIT_INC="%{LUAJIT_INC}" \\
+LUAJIT_LIB="%{LUAJIT_LIB}" \\
+endef
+export MODULE_ENV_lua
+
+define MODULE_PREINSTALL_lua
+%{__rm} -f %{bdir}/objs/ndk_http_module.so %{bdir}/objs/ndk_http_module-debug.so
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_bindir}
+%{__install} -m755 %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/bin/nginx-luajit \
+   $$RPM_BUILD_ROOT%{_bindir}/
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_datadir}/nginx-luajit-2.1/jit
+for f in `find %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/share/nginx-luajit-2.1/jit/ -type f`; do
+    %{__install} -m644 $${f} $$RPM_BUILD_ROOT%{_datadir}/nginx-luajit-2.1/jit/
+done
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_includedir}/nginx-luajit-2.1
+for f in `find %{bdir}/luajit2-$(LUAJIT2_VERSION)/usr/include/nginx-luajit-2.1/ -type f`; do
+    %{__install} -m644 $${f} $$RPM_BUILD_ROOT%{_includedir}/nginx-luajit-2.1/
+done
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_includedir}/nginx-luajit-2.1/resty
+cd %{bdir}/lua-resty-core-$(LUA_RESTY_CORE_VERSION) \&\& \
+    LUA_LIB_DIR=$$RPM_BUILD_ROOT%{_datadir}/nginx-luajit-2.1 make install
+cd %{bdir}/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION) \&\& \
+    LUA_LIB_DIR=$$RPM_BUILD_ROOT%{_datadir}/nginx-luajit-2.1 make install
+endef
+export MODULE_PREINSTALL_lua
+
+define MODULE_FILES_lua
+%{_bindir}/nginx-luajit
+%dir %{_datadir}/nginx-luajit-2.1/jit
+%{_datadir}/nginx-luajit-2.1/jit/*
+%dir %{_datadir}/nginx-luajit-2.1/ngx
+%{_datadir}/nginx-luajit-2.1/ngx/*
+%dir %{_datadir}/nginx-luajit-2.1/resty
+%{_datadir}/nginx-luajit-2.1/resty/*
+%dir %{_includedir}/nginx-luajit-2.1
+%{_includedir}/nginx-luajit-2.1/*
+endef
+export MODULE_FILES_lua
+
+define MODULE_POST_lua
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_lua) for $(MODULE_SUMMARY_PREFIX) have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_lua_module.so;
+    load_module modules/ngx_stream_lua_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+These modules are compiled with LuaJIT 2.1 library.
+The following binary should be used for testing and bytecode generation:
+
+    /usr/bin/nginx-luajit
+
+Please refer to the modules documentation for further details:
+https://github.com/openresty/lua-nginx-module
+https://github.com/openresty/stream-lua-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_lua
diff --git a/rpm/SPECS/Makefile.module-modsecurity b/rpm/SPECS/Makefile.module-modsecurity
new file mode 100644
index 0000000..392a07c
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-modsecurity
@@ -0,0 +1,100 @@
+MODULES+=	modsecurity
+
+MODULE_SUMMARY_modsecurity=	3rd-party ModSecurity dynamic module
+
+include $(CONTRIB)/src/modsecurity/version
+include $(CONTRIB)/src/modsecurity-nginx/version
+
+MODULE_VERSION_modsecurity=	$(MODSECURITY_NGINX_VERSION)
+MODULE_RELEASE_modsecurity=	1
+LIBMODSECURITY_SOVER=		$(MODSECURITY_VERSION)
+
+MODULE_VERSION_PREFIX_modsecurity=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_modsecurity=	modsecurity-v$(MODSECURITY_VERSION).tar.gz \
+				modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH).tar.xz
+
+MODULE_PATCHES_modsecurity=	$(CONTRIB)/src/modsecurity/PR2348.patch \
+				$(CONTRIB)/src/modsecurity-nginx/PR165.patch
+
+MODULE_CONFARGS_modsecurity=	--add-dynamic-module=modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)
+
+.deps-module-modsecurity:
+	cd $(CONTRIB) && make \
+		.sum-modsecurity \
+		.sum-modsecurity-nginx
+	touch $@
+
+define MODULE_DEFINITIONS_modsecurity
+BuildRequires: gcc-c++
+BuildRequires: yajl-devel
+BuildRequires: libcurl-devel
+BuildRequires: libxml2-devel
+endef
+export MODULE_DEFINITIONS_modsecurity
+
+define MODULE_PREBUILD_modsecurity
+cd %{bdir}/modsecurity-v$(MODSECURITY_VERSION) \&\& \
+./configure --prefix %{bdir}/modsecurity-v$(MODSECURITY_VERSION)/local --without-lmdb --without-lua \&\& \
+make %{?_smp_mflags} install \&\& TERM=foo make check-TESTS
+rm -f /tmp/audit_test.log /tmp/audit_test_parallel.log
+rm -rf /tmp/test
+endef
+export MODULE_PREBUILD_modsecurity
+
+define MODULE_ENV_modsecurity
+MODSECURITY_INC="%{bdir}/modsecurity-v$(MODSECURITY_VERSION)/local/include" \\
+MODSECURITY_LIB="%{bdir}/modsecurity-v$(MODSECURITY_VERSION)/local/lib" \\
+NGX_IGNORE_RPATH=yes \\
+endef
+export MODULE_ENV_modsecurity
+
+MODULE_CC_OPT_DEBUG_modsecurity=-DMODSECURITY_DDEBUG=1
+
+define MODULE_PREINSTALL_modsecurity
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_bindir}
+%{__install} -m755 -s %{bdir}/modsecurity-v$(MODSECURITY_VERSION)/local/bin/modsec-rules-check \
+   $$RPM_BUILD_ROOT%{_bindir}/
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_libdir}
+%{__install} -m755 %{bdir}/modsecurity-v$(MODSECURITY_VERSION)/local/lib/libmodsecurity.so.$(LIBMODSECURITY_SOVER) \
+   $$RPM_BUILD_ROOT%{_libdir}/
+%{__ln_s} -f libmodsecurity.so.$(LIBMODSECURITY_SOVER) $$RPM_BUILD_ROOT%{_libdir}/libmodsecurity.so.3
+%{__ln_s} -f libmodsecurity.so.$(LIBMODSECURITY_SOVER) $$RPM_BUILD_ROOT%{_libdir}/libmodsecurity.so
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_sysconfdir}/nginx/modsec
+%{__install} -m644 %{bdir}/modsecurity-v$(MODSECURITY_VERSION)/modsecurity.conf-recommended \
+   $$RPM_BUILD_ROOT%{_sysconfdir}/nginx/modsec/modsecurity.conf
+%{__install} -m644 %{bdir}/modsecurity-v$(MODSECURITY_VERSION)/unicode.mapping \
+   $$RPM_BUILD_ROOT%{_sysconfdir}/nginx/modsec/
+endef
+export MODULE_PREINSTALL_modsecurity
+
+define MODULE_FILES_modsecurity
+%dir %{_sysconfdir}/nginx/modsec
+%config(noreplace) %{_sysconfdir}/nginx/modsec/modsecurity.conf
+%config(noreplace) %{_sysconfdir}/nginx/modsec/unicode.mapping
+%{_bindir}/modsec-rules-check
+%{_libdir}/libmodsecurity.so.$(LIBMODSECURITY_SOVER)
+%{_libdir}/libmodsecurity.so.3
+%{_libdir}/libmodsecurity.so
+endef
+export MODULE_FILES_modsecurity
+
+MODULE_TESTS_modsecurity=modsecurity-nginx-$(MODSECURITY_NGINX_GITHASH)/tests
+
+define MODULE_POST_modsecurity
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_modsecurity) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_modsecurity_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/SpiderLabs/ModSecurity-nginx
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_modsecurity
diff --git a/rpm/SPECS/Makefile.module-ndk b/rpm/SPECS/Makefile.module-ndk
new file mode 100644
index 0000000..60d94fd
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-ndk
@@ -0,0 +1,45 @@
+MODULES+=	ndk
+
+MODULE_SUMMARY_ndk=	3rd-party NDK dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+
+MODULE_VERSION_ndk=	$(NGX_DEVEL_KIT_VERSION)
+MODULE_RELEASE_ndk=	1
+
+MODULE_VERSION_PREFIX_ndk=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_ndk=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz
+
+MODULE_CONFARGS_ndk=	--add-dynamic-module=ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION)
+
+.deps-module-ndk:
+	cd $(CONTRIB) && make .sum-ngx_devel_kit
+	touch $@
+
+MODULE_CC_OPT_ndk=-DNDK_SET_VAR -DNDK_UPSTREAM_LIST
+MODULE_CC_OPT_DEBUG_ndk=$(MODULE_CC_OPT_ndk)
+
+ifeq ($(MODULE_TARGET), plus)
+NDK_DEPENDENCY_TAG=	nginx-plus-module-ndk-r$(PLUS_VERSION)
+else
+NDK_DEPENDENCY_TAG=	nginx-module-ndk-r$(BASE_VERSION)
+endif
+
+define MODULE_POST_ndk
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_ndk) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/simpl/ngx_devel_kit
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_ndk
diff --git a/rpm/SPECS/Makefile.module-njs b/rpm/SPECS/Makefile.module-njs
index 97a2704..719dd7d 100644
--- a/rpm/SPECS/Makefile.module-njs
+++ b/rpm/SPECS/Makefile.module-njs
@@ -2,14 +2,20 @@
 
 MODULE_SUMMARY_njs=	njs dynamic modules
 
-MODULE_VERSION_njs=	0.5.0
+include $(CONTRIB)/src/njs/version
+
+MODULE_VERSION_njs=	$(NJS_VERSION)
 MODULE_RELEASE_njs=	1
 
 MODULE_VERSION_PREFIX_njs=$(MODULE_TARGET_PREFIX)
 
-MODULE_SOURCES_njs=	njs-$(MODULE_VERSION_njs).tar.gz
+MODULE_SOURCES_njs=	njs-$(NJS_VERSION).tar.gz
 
-MODULE_CONFARGS_njs=	--add-dynamic-module=njs-$(MODULE_VERSION_njs)/nginx
+MODULE_CONFARGS_njs=	--add-dynamic-module=njs-$(NJS_VERSION)/nginx
+
+.deps-module-njs:
+	cd $(CONTRIB) && make .sum-njs
+	touch $@
 
 define MODULE_DEFINITIONS_njs
 BuildRequires: libedit-devel
@@ -17,15 +23,15 @@
 export MODULE_DEFINITIONS_njs
 
 define MODULE_PREBUILD_njs
-cd %{bdir}/njs-$(MODULE_VERSION_njs) \&\& ./configure \&\& make njs
+cd %{bdir}/njs-$(NJS_VERSION) \&\& ./configure \&\& make njs
 endef
 export MODULE_PREBUILD_njs
 
 define MODULE_PREINSTALL_njs
-%{__install} -m644 %{bdir}/njs-$(MODULE_VERSION_njs)/CHANGES \
+%{__install} -m644 %{bdir}/njs-$(NJS_VERSION)/CHANGES \
         $$RPM_BUILD_ROOT%{_datadir}/doc/%{name}/
 %{__mkdir} -p $$RPM_BUILD_ROOT%{_bindir}
-%{__install} -m755 %{bdir}/njs-$(MODULE_VERSION_njs)/build/njs \
+%{__install} -m755 %{bdir}/njs-$(NJS_VERSION)/build/njs \
         $$RPM_BUILD_ROOT%{_bindir}/
 endef
 export MODULE_PREINSTALL_njs
@@ -47,9 +53,9 @@
     load_module modules/ngx_stream_js_module.so;
 
 Please refer to the modules documentation for further details:
-http://nginx.org/en/docs/njs/
-http://nginx.org/en/docs/http/ngx_http_js_module.html
-http://nginx.org/en/docs/stream/ngx_stream_js_module.html
+https://nginx.org/en/docs/njs/
+https://nginx.org/en/docs/http/ngx_http_js_module.html
+https://nginx.org/en/docs/stream/ngx_stream_js_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/rpm/SPECS/Makefile.module-opentracing b/rpm/SPECS/Makefile.module-opentracing
new file mode 100644
index 0000000..2a2a9f4
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-opentracing
@@ -0,0 +1,126 @@
+MODULES+=	opentracing
+
+MODULE_SUMMARY_opentracing=	3rd-party OpenTracing dynamic module
+
+include $(CONTRIB)/src/opentracing-cpp/version
+include $(CONTRIB)/src/nginx-opentracing/version
+include $(CONTRIB)/src/jaeger-client-cpp/version
+
+MODULE_VERSION_opentracing=	$(NGINX_OPENTRACING_VERSION)
+MODULE_RELEASE_opentracing=	1
+
+MODULE_VERSION_PREFIX_opentracing=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_opentracing=	opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz \
+				nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz \
+				jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz
+
+MODULE_PATCHES_opentracing=	$(CONTRIB)/src/opentracing-cpp/CMakeLists.txt.patch \
+				$(CONTRIB)/src/jaeger-client-cpp/CMakeLists.txt.patch
+
+MODULE_CONFARGS_opentracing=	--add-dynamic-module=nginx-opentracing-$(NGINX_OPENTRACING_VERSION)/opentracing
+
+.deps-module-opentracing:
+	cd $(CONTRIB) && make \
+		.sum-opentracing-cpp \
+		.sum-nginx-opentracing \
+		.sum-jaeger-client-cpp
+	touch $@
+
+define MODULE_DEFINITIONS_opentracing
+%if (0%{?rhel} > 0) || (0%{?amzn} > 0)
+%if (0%{?rhel} >= 8)
+BuildRequires: cmake
+%define _cmake_cmd %{__cmake}
+%else
+BuildRequires: cmake3
+%define _cmake_cmd %{__cmake3}
+%endif
+%endif
+
+%if (0%{?suse_version} >= 1500) || (0%{?fedora} > 0)
+BuildRequires: cmake
+%define _cmake_cmd %{__cmake}
+%endif
+BuildRequires: libstdc++-static
+BuildRequires: yaml-cpp-devel
+endef
+export MODULE_DEFINITIONS_opentracing
+
+MODULE_CC_OPT_opentracing=-I%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include
+MODULE_CC_OPT_DEBUG_opentracing=$(MODULE_CC_OPT_opentracing)
+MODULE_LD_OPT_opentracing=-L%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib
+MODULE_LD_OPT_DEBUG_opentracing=$(MODULE_LD_OPT_opentracing)
+
+define MODULE_PREBUILD_opentracing
+cd %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION) \&\& \
+mkdir .build \&\& \
+cd .build \&\& \
+%{_cmake_cmd} ../ \&\& \
+DESTDIR=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION) make %{?_smp_mflags} install || exit 1
+cd %{bdir}/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION) \&\& \
+mkdir .build \&\& \
+cd .build \&\& \
+OpenTracing_DIR=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/.build %{_cmake_cmd} -DCMAKE_BUILD_TYPE=Release -DJAEGERTRACING_PLUGIN=ON -DHUNTER_CONFIGURATION_TYPES=Release -DBUILD_TESTING=OFF ../ -DOPENTRACING_INC=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include \&\& \
+make %{?_smp_mflags} || exit 1
+endef
+export MODULE_PREBUILD_opentracing
+
+define MODULE_PREINSTALL_opentracing
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_libdir}
+%{__install} -m755 %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing.so.$(OPENTRACING_CPP_VERSION) \
+   $$RPM_BUILD_ROOT%{_libdir}/
+%{__install} -m755 %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) \
+   $$RPM_BUILD_ROOT%{_libdir}/
+%{__ln_s} -f libopentracing.so.$(OPENTRACING_CPP_VERSION) $$RPM_BUILD_ROOT%{_libdir}/libopentracing.so.1
+%{__ln_s} -f libopentracing.so.1 $$RPM_BUILD_ROOT%{_libdir}/libopentracing.so
+%{__ln_s} -f libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) $$RPM_BUILD_ROOT%{_libdir}/libopentracing_mocktracer.so.1
+%{__ln_s} -f libopentracing_mocktracer.so.1 $$RPM_BUILD_ROOT%{_libdir}/libopentracing_mocktracer.so
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_includedir}
+%{__cp} -rp %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include/opentracing $$RPM_BUILD_ROOT%{_includedir}/
+%{__mkdir} -p $$RPM_BUILD_ROOT%{_libexecdir}/opentracing
+%{__install} -m755 %{bdir}/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION)/.build/libjaegertracing_plugin.so $$RPM_BUILD_ROOT%{_libexecdir}/opentracing/
+endef
+export MODULE_PREINSTALL_opentracing
+
+define MODULE_FILES_opentracing
+%{_libdir}/libopentracing.so.$(OPENTRACING_CPP_VERSION)
+%{_libdir}/libopentracing.so.1
+%{_libdir}/libopentracing.so
+%{_libdir}/libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION)
+%{_libdir}/libopentracing_mocktracer.so.1
+%{_libdir}/libopentracing_mocktracer.so
+%dir %{_libexecdir}/opentracing
+%{_libexecdir}/opentracing/libjaegertracing_plugin.so
+%dir %{_includedir}/opentracing
+%{_includedir}/opentracing/*
+endef
+export MODULE_FILES_opentracing
+
+define MODULE_POST_opentracing
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_opentracing) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_opentracing_module.so;
+
+Note that additional tracer plugins are required in order
+to communicate with corresponding services (e.g. Zipkin, Jaeger).
+This package includes the Jaeger dynamic tracer plugin:
+
+    /usr/libexec/opentracing/libjaegertracing_plugin.so
+
+Please refer to the module documentation for further details:
+https://github.com/opentracing-contrib/nginx-opentracing
+https://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md
+
+OpenTracing project site (general info and documentation):
+https://opentracing.io/
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_opentracing
diff --git a/rpm/SPECS/Makefile.module-passenger b/rpm/SPECS/Makefile.module-passenger
new file mode 100644
index 0000000..1fa2793
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-passenger
@@ -0,0 +1,43 @@
+MODULES+=	passenger
+
+MODULE_SUMMARY_passenger=	3rd-party Passenger dynamic module
+
+include $(CONTRIB)/src/passenger/version
+
+MODULE_VERSION_passenger=	$(PASSENGER_VERSION)
+MODULE_RELEASE_passenger=	1
+
+MODULE_VERSION_PREFIX_passenger=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_passenger=	passenger-$(PASSENGER_VERSION).tar.gz
+MODULE_PATCHES_passenger=	$(CONTRIB)/src/passenger/build-nginx.rb.patch
+
+MODULE_CONFARGS_passenger=	--with-http_ssl_module \
+				--add-dynamic-module=passenger-$(PASSENGER_VERSION)/src/nginx_module
+
+.deps-module-passenger:
+	cd $(CONTRIB) && make .sum-passenger
+	touch $@
+
+define MODULE_DEFINITIONS_passenger
+BuildRequires: rubygem-rake
+endef
+export MODULE_DEFINITIONS_passenger
+
+define MODULE_POST_passenger
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_passenger) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_passenger_module.so;
+
+Please refer to the module documentation for further details:
+https://www.phusionpassenger.com/
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_passenger
diff --git a/rpm/SPECS/Makefile.module-perl b/rpm/SPECS/Makefile.module-perl
index 67205fa..826fbfc 100644
--- a/rpm/SPECS/Makefile.module-perl
+++ b/rpm/SPECS/Makefile.module-perl
@@ -47,7 +47,7 @@
     load_module modules/ngx_http_perl_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_perl_module.html
+https://nginx.org/en/docs/http/ngx_http_perl_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/rpm/SPECS/Makefile.module-rtmp b/rpm/SPECS/Makefile.module-rtmp
new file mode 100644
index 0000000..4eb68b0
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-rtmp
@@ -0,0 +1,37 @@
+MODULES+=	rtmp
+
+MODULE_SUMMARY_rtmp=	3rd-party RTMP dynamic module
+
+include $(CONTRIB)/src/nginx-rtmp-module/version 
+
+MODULE_VERSION_rtmp=	$(NGINX_RTMP_MODULE_VERSION)
+MODULE_RELEASE_rtmp=	1
+
+MODULE_VERSION_PREFIX_rtmp=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_rtmp=	nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION).tar.gz
+MODULE_PATCHES_rtmp=	$(CONTRIB)/src/nginx-rtmp-module/PR1340.patch
+
+MODULE_CONFARGS_rtmp=	--add-dynamic-module=nginx-rtmp-module-$(NGINX_RTMP_MODULE_VERSION)
+
+.deps-module-rtmp:
+	cd $(CONTRIB) && make .sum-nginx-rtmp-module
+	touch $@
+
+define MODULE_POST_rtmp
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_rtmp) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_rtmp_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/arut/nginx-rtmp-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_rtmp
diff --git a/rpm/SPECS/Makefile.module-set-misc b/rpm/SPECS/Makefile.module-set-misc
new file mode 100644
index 0000000..33d82d7
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-set-misc
@@ -0,0 +1,55 @@
+MODULES+=	set-misc
+
+MODULE_SUMMARY_set_misc=	3rd-party set-misc dynamic module
+
+include $(CONTRIB)/src/ngx_devel_kit/version
+include $(CONTRIB)/src/set-misc-nginx-module/version
+
+MODULE_VERSION_set_misc=	$(SET_MISC_NGINX_MODULE_VERSION)
+MODULE_RELEASE_set_misc=	1
+
+MODULE_VERSION_PREFIX_set_misc=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_set_misc=	ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz \
+				set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION).tar.gz
+
+MODULE_CONFARGS_set_misc=	--with-http_ssl_module \
+				--add-dynamic-module=ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \
+				--add-dynamic-module=set-misc-nginx-module-$(SET_MISC_NGINX_MODULE_VERSION)
+
+.deps-module-set-misc:
+	cd $(CONTRIB) && make \
+		.sum-ngx_devel_kit \
+		.sum-set-misc-nginx-module
+	touch $@
+
+define MODULE_DEFINITIONS_set_misc
+Requires: $(NDK_DEPENDENCY_TAG)
+endef
+export MODULE_DEFINITIONS_set_misc
+
+define MODULE_PREINSTALL_set_misc
+%{__rm} -f %{bdir}/objs/ndk_http_module.so %{bdir}/objs/ndk_http_module-debug.so
+endef
+export MODULE_PREINSTALL_set_misc
+
+define MODULE_POST_set_misc
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_set_misc) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ndk_http_module.so;
+    load_module modules/ngx_http_set_misc_module.so;
+
+Note that ndk_http_module.so must be placed first.
+
+Please refer to the module documentation for further details:
+https://github.com/openresty/set-misc-nginx-module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_set_misc
diff --git a/rpm/SPECS/Makefile.module-subs-filter b/rpm/SPECS/Makefile.module-subs-filter
new file mode 100644
index 0000000..cf2d1ee
--- /dev/null
+++ b/rpm/SPECS/Makefile.module-subs-filter
@@ -0,0 +1,36 @@
+MODULES+=	subs-filter
+
+MODULE_SUMMARY_subs_filter=	3rd-party substitution dynamic module
+
+include $(CONTRIB)/src/ngx_http_substitutions_filter_module/version
+
+MODULE_VERSION_subs_filter=	$(SUBSTITUTIONS_FILTER_NGINX_MODULE_VERSION)
+MODULE_RELEASE_subs_filter=	1
+
+MODULE_VERSION_PREFIX_subs_filter=$(MODULE_TARGET_PREFIX)
+
+MODULE_SOURCES_subs_filter=	ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH).tar.xz
+
+MODULE_CONFARGS_subs_filter=	--add-dynamic-module=ngx_http_substitutions_filter_module-$(SUBSTITUTIONS_FILTER_NGINX_MODULE_GITHASH)
+
+.deps-module-subs-filter:
+	cd $(CONTRIB) && make .sum-ngx_http_substitutions_filter_module
+	touch $@
+
+define MODULE_POST_subs_filter
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_subs_filter) for $(MODULE_SUMMARY_PREFIX) has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_subs_filter_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/yaoweibin/ngx_http_substitutions_filter_module
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_subs_filter
diff --git a/rpm/SPECS/Makefile.module-xslt b/rpm/SPECS/Makefile.module-xslt
index 4403110..86a9452 100644
--- a/rpm/SPECS/Makefile.module-xslt
+++ b/rpm/SPECS/Makefile.module-xslt
@@ -9,7 +9,6 @@
 
 define MODULE_DEFINITIONS_xslt
 BuildRequires: libxslt-devel
-Requires: libxslt
 endef
 export MODULE_DEFINITIONS_xslt
 
@@ -24,7 +23,7 @@
     load_module modules/ngx_http_xslt_filter_module.so;
 
 Please refer to the module documentation for further details:
-http://nginx.org/en/docs/http/ngx_http_xslt_module.html
+https://nginx.org/en/docs/http/ngx_http_xslt_module.html
 
 ----------------------------------------------------------------------
 BANNER
diff --git a/rpm/SPECS/nginx-module.spec.in b/rpm/SPECS/nginx-module.spec.in
index 139d6fb..78ac7db 100644
--- a/rpm/SPECS/nginx-module.spec.in
+++ b/rpm/SPECS/nginx-module.spec.in
@@ -45,7 +45,7 @@
 URL: %%MODULE_PACKAGE_URL%%
 Group: %{_group}
 
-Source0: http://nginx.org/download/nginx-%{base_version}.tar.gz
+Source0: https://nginx.org/download/nginx-%{base_version}.tar.gz
 Source1: %%COPYRIGHT_SOURCE%%
 %%MODULE_SOURCES%%
 
diff --git a/rpm/SPECS/nginx-plus-module.spec.in b/rpm/SPECS/nginx-plus-module.spec.in
index 560cae3..0862eff 100644
--- a/rpm/SPECS/nginx-plus-module.spec.in
+++ b/rpm/SPECS/nginx-plus-module.spec.in
@@ -42,7 +42,7 @@
 URL: %%MODULE_PACKAGE_URL%%
 Group: %{_group}
 
-Source0: http://nginx.org/download/nginx-%{base_version}.tar.gz
+Source0: https://nginx.org/download/nginx-%{base_version}.tar.gz
 Source1: %%COPYRIGHT_SOURCE%%
 %%MODULE_SOURCES%%
 
diff --git a/rpm/SPECS/nginx.spec.in b/rpm/SPECS/nginx.spec.in
index 2cffcd6..dbb0311 100644
--- a/rpm/SPECS/nginx.spec.in
+++ b/rpm/SPECS/nginx.spec.in
@@ -76,10 +76,10 @@
 Version: %{base_version}
 Release: %{base_release}
 Vendor: Nginx, Inc.
-URL: http://nginx.org/
+URL: https://nginx.org/
 Group: %{_group}
 
-Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
+Source0: https://nginx.org/download/%{name}-%{version}.tar.gz
 Source1: logrotate
 Source2: nginx.init.in
 Source3: nginx.sysconf
@@ -284,14 +284,14 @@
 Thanks for using nginx!
 
 Please find the official documentation for nginx here:
-* http://nginx.org/en/docs/
+* https://nginx.org/en/docs/
 
 Please subscribe to nginx-announce mailing list to get
 the most important news about nginx:
-* http://nginx.org/en/support.html
+* https://nginx.org/en/support.html
 
 Commercial subscriptions for nginx are available on:
-* http://nginx.com/products/
+* https://nginx.com/products/
 
 ----------------------------------------------------------------------
 BANNER