Skip to content

Commit

Permalink
Add ngx_http_geoip2_module (#18)
Browse files Browse the repository at this point in the history
* Add ngx_http_geoip2_module

* Add geoip2 and reorder README.md

* See why build failed

* Geoip2 needs libmaxminddb0 installed

* Try libmaxminddb-dev

* Silence output
  • Loading branch information
ononoki1 authored May 13, 2022
1 parent c3ce17f commit 1ac0fa2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
- Based on latest [NGINX](https://hg.nginx.org/nginx) mainline version
- HTTP/3 and QUIC support, powered by [nginx-quic](https://hg.nginx.org/nginx-quic)
- Brotli support, powered by [ngx_brotli](https://github.com/google/ngx_brotli)
- GeoIP2 support, powered by [ngx_http_geoip2_module](https://github.com/leev/ngx_http_geoip2_module)
- Headers More support, powered by [ngx_headers_more](https://github.com/openresty/headers-more-nginx-module)
- OCSP stapling support, powered by [this patch](https://github.com/kn007/patch/blob/master/Enable_BoringSSL_OCSP.patch)
- WAF support, powered by [ngx_waf](https://github.com/ADD-SP/ngx_waf/tree/current)
- Security Headers support, powered by [ngx_security_headers](https://github.com/GetPageSpeed/ngx_security_headers)
- WAF support, powered by [ngx_waf](https://github.com/ADD-SP/ngx_waf/tree/current)
- Zstandard support, powered by [zstd-nginx-module](https://github.com/tokers/zstd-nginx-module)
- Use [BoringSSL](https://github.com/google/boringssl), [Cloudflare's zlib](https://github.com/cloudflare/zlib) and [jemalloc](https://github.com/jemalloc/jemalloc)
- Use OpenSSL's hash functions instead of NGINX's, powered by [this patch](https://github.com/kn007/patch/blob/master/use_openssl_md5_sha1.patch)
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set -e
cd /github/home
echo Install dependencies.
apt-get update > /dev/null 2>&1
apt-get install --allow-change-held-packages --allow-downgrades --allow-remove-essential -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -fy cmake curl git golang libcurl4-openssl-dev libmodsecurity-dev libsodium-dev libunwind-dev libzstd-dev mercurial ninja-build rsync wget > /dev/null 2>&1
apt-get install --allow-change-held-packages --allow-downgrades --allow-remove-essential -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -fy cmake curl git golang libcurl4-openssl-dev libmaxminddb-dev libmodsecurity-dev libsodium-dev libunwind-dev libzstd-dev mercurial ninja-build rsync wget > /dev/null 2>&1
wget -qO /etc/apt/trusted.gpg.d/nginx_signing.asc https://nginx.org/keys/nginx_signing.key
echo deb-src http://nginx.org/packages/mainline/debian bullseye nginx >> /etc/apt/sources.list
echo -e 'Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900' > /etc/apt/preferences.d/99nginx
Expand Down Expand Up @@ -45,13 +45,14 @@ cd zlib
make -f Makefile.in distclean > /dev/null 2>&1
cd ..
git clone --recursive https://github.com/google/ngx_brotli > /dev/null 2>&1
git clone https://github.com/leev/ngx_http_geoip2_module > /dev/null 2>&1
git clone https://github.com/openresty/headers-more-nginx-module > /dev/null 2>&1
git clone https://github.com/GetPageSpeed/ngx_security_headers > /dev/null 2>&1
git clone https://github.com/tokers/zstd-nginx-module > /dev/null 2>&1
echo Build nginx.
cd ..
sed -i 's/CFLAGS=""/CFLAGS="-fstack-protector-strong -Wno-ignored-qualifiers -Wno-sign-compare"/g' rules
sed -i 's/--sbin-path=\/usr\/sbin\/nginx/--sbin-path=\/usr\/sbin\/nginx --add-module=$(CURDIR)\/debian\/modules\/ngx_waf --add-module=$(CURDIR)\/debian\/modules\/ngx_brotli --add-module=$(CURDIR)\/debian\/modules\/headers-more-nginx-module --add-module=$(CURDIR)\/debian\/modules\/ngx_security_headers --add-module=$(CURDIR)\/debian\/modules\/zstd-nginx-module/g' rules
sed -i 's/--sbin-path=\/usr\/sbin\/nginx/--sbin-path=\/usr\/sbin\/nginx --add-module=$(CURDIR)\/debian\/modules\/ngx_waf --add-module=$(CURDIR)\/debian\/modules\/ngx_brotli --add-module=$(CURDIR)\/debian\/modules\/ngx_http_geoip2_module --add-module=$(CURDIR)\/debian\/modules\/headers-more-nginx-module --add-module=$(CURDIR)\/debian\/modules\/ngx_security_headers --add-module=$(CURDIR)\/debian\/modules\/zstd-nginx-module/g' rules
sed -i 's/--with-cc-opt="$(CFLAGS)" --with-ld-opt="$(LDFLAGS)"/--with-http_v3_module --with-stream_quic_module --with-zlib=$(CURDIR)\/debian\/modules\/zlib --with-cc-opt="-I..\/modules\/boringssl\/include $(CFLAGS)" --with-ld-opt="-ljemalloc -L..\/modules\/boringssl\/build\/ssl -L..\/modules\/boringssl\/build\/crypto $(LDFLAGS)"/g' rules
sed -i 's/dh_shlibdeps -a/dh_shlibdeps -a -- --ignore-missing-info/g' rules
cd ..
Expand Down

0 comments on commit 1ac0fa2

Please sign in to comment.