diff --git a/modules/Dockerfile b/modules/Dockerfile
index e9dea75b1c4253df7646ffe8d940bd693e217b1a..61573c17cb68cb47e032ff2002a1fa4c4cf3161a 100644
--- a/modules/Dockerfile
+++ b/modules/Dockerfile
@@ -14,11 +14,11 @@ COPY ./ /modules/
 
 RUN apt-get update \
     && apt-get install -y --no-install-suggests --no-install-recommends \
-                patch make wget mercurial devscripts debhelper dpkg-dev \
+                patch make wget git devscripts debhelper dpkg-dev \
                 quilt lsb-release build-essential libxml2-utils xsltproc \
                 equivs git g++ libparse-recdescent-perl \
     && XSLSCRIPT_SHA512="f7194c5198daeab9b3b0c3aebf006922c7df1d345d454bd8474489ff2eb6b4bf8e2ffe442489a45d1aab80da6ecebe0097759a1e12cc26b5f0613d05b7c09ffa *stdin" \
-    && wget -O /tmp/xslscript.pl https://hg.nginx.org/xslscript/raw-file/01dc9ba12e1b/xslscript.pl \
+    && wget -O /tmp/xslscript.pl https://raw.githubusercontent.com/nginx/xslscript/9204424259c343ca08a18a78915f40f28025e093/xslscript.pl \
     && if [ "$(cat /tmp/xslscript.pl | openssl sha512 -r)" = "$XSLSCRIPT_SHA512" ]; then \
         echo "XSLScript checksum verification succeeded!"; \
         chmod +x /tmp/xslscript.pl; \
@@ -27,7 +27,7 @@ RUN apt-get update \
         echo "XSLScript checksum verification failed!"; \
         exit 1; \
     fi \
-    && hg clone -r ${NGINX_VERSION}-${PKG_RELEASE%%~*} https://hg.nginx.org/pkg-oss/ \
+    && git clone -b ${NGINX_VERSION}-${PKG_RELEASE%%~*} https://github.com/nginx/pkg-oss/ \
     && cd pkg-oss \
     && mkdir /tmp/packages \
     && for module in $ENABLED_MODULES; do \
diff --git a/modules/Dockerfile.alpine b/modules/Dockerfile.alpine
index f6d39c0db92552bd8795b755f711b95cd48249a9..9b305fff5b7f5f0c98fd21f682b6e0068ec17b7e 100644
--- a/modules/Dockerfile.alpine
+++ b/modules/Dockerfile.alpine
@@ -19,7 +19,7 @@ RUN apk update \
     # allow abuild as a root user \
     && printf "#!/bin/sh\\nSETFATTR=true /usr/bin/abuild -F \"\$@\"\\n" > /usr/local/bin/abuild \
     && chmod +x /usr/local/bin/abuild \
-    && hg clone -r ${NGINX_VERSION}-${PKG_RELEASE} https://hg.nginx.org/pkg-oss/ \
+    && git clone -b ${NGINX_VERSION}-${PKG_RELEASE} https://github.com/nginx/pkg-oss/ \
     && cd pkg-oss \
     && mkdir /tmp/packages \
     && for module in $ENABLED_MODULES; do \
diff --git a/modules/README.md b/modules/README.md
index e1ff4ba7340de8c4d4983bfb2d69263dc089acf4..624b97cc008f25dbde0b6c57268da7b4654128a0 100644
--- a/modules/README.md
+++ b/modules/README.md
@@ -3,7 +3,7 @@
 It's possible to extend a mainline image with third-party modules either from
 your own instuctions following a simple filesystem layout/syntax using
 `build_module.sh` helper script, or falling back to package sources from
-[pkg-oss](https://hg.nginx.org/pkg-oss).
+[pkg-oss](https://github.com/nginx/pkg-oss).
 
 ## Requirements
 
@@ -101,7 +101,7 @@ reproduce with a vanilla image first.
 ### docker-compose with pre-packaged modules
 
 If desired modules are already packaged in
-[pkg-oss](https://hg.nginx.org/pkg-oss/) - e.g. `debian/Makefile.module-*`
+[pkg-oss](https://github.com/nginx/pkg-oss/) - e.g. `debian/Makefile.module-*`
 exists for a given module, you can use this example.
 
 1. Create a directory for your project: