nginx: add support for MaxMind GeoIP2 databases
authorJavier Marcet <javier@marcet.info>
Fri, 30 Jun 2023 14:21:19 +0000 (16:21 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Wed, 5 Jul 2023 18:54:44 +0000 (20:54 +0200)
Signed-off-by: Javier Marcet <javier@marcet.info>
net/nginx/Makefile

index 56b9cc382e70afd9db61cfbade5ed006b33b467f..2937c96ce18b535d3f1b09b87e9f980e164d81bb 100644 (file)
@@ -27,6 +27,7 @@ PKG_BUILD_FLAGS:=gc-sections
 
 # 3rd-party modules
 PKG_MOD_EXTRA := \
+       geoip2 \
        lua \
        rtmp \
        dav-ext \
@@ -198,6 +199,13 @@ define Package/nginx-mod-luci/install
        $(INSTALL_BIN) ./files-luci-support/60_nginx-luci-support $(1)/etc/uci-defaults/60_nginx-luci-support
 endef
 
+define Download/nginx-mod-geoip2
+  VERSION:=1cabd8a1f68ea3998f94e9f3504431970f848fbf
+  URL:=https://github.com/leev/ngx_http_geoip2_module.git
+  MIRROR_HASH:=b4bd8517f6595f28e9cea5370045df476e0f7fa9ca3611d71ba85c518f1a7eda
+  PROTO:=git
+endef
+
 define Download/nginx-mod-headers-more
   VERSION:=bea1be3bbf6af28f6aa8cf0c01c07ee1637e2bd0
   URL:=https://github.com/openresty/headers-more-nginx-module.git
@@ -423,6 +431,8 @@ $(eval $(call BuildModule,brotli,,ngx_http_brotli_filter ngx_http_brotli_static,
        Add support for brotli compression module.))
 $(eval $(call BuildModule,naxsi,,ngx_http_naxsi, \
        Enable NAXSI module.))
+$(eval $(call BuildModule,geoip2,+@NGINX_STREAM_CORE_MODULE +libmaxminddb,ngx_http_geoip2 ngx_stream_geoip2, \
+       Enable MaxMind GeoIP2 module.))
 
 # TODO: remove after a transition period (together with pkg nginx-util):
 # It is for smoothly substituting nginx and nginx-mod-luci-ssl (by nginx-ssl