我可以在 NGINX 中执行 GeoIP 阻止而无需为 NGINX Plus 付费吗?

Can I perform GeoIP blocking in NGINX without having to pay for NGINX Plus?

我是 Fedora 29 最终用户,正在寻找一种通过 NGINX 执行 GeoIP 阻止的方法,而无需为 Nginx Plus 支付大量 $$。我看到 NGINX 可以设置为包含模块,想问一下是否有任何开源模块可用于执行基本的 GeoIP 阻塞。

谢谢,

您可以通过将“--with-http_geoip_module”添加到 nginx 构建配置来构建 nginx 并从 nginx https://nginx.org/en/docs/http/ngx_http_geoip_module.html 添加 geoip 模块。

然后在您的 nginx.conf 中指定 geoip_country 或 geoip_city 后跟 geoip db

的路径

https://docs.nginx.com/nginx/admin-guide/security-controls/controlling-access-by-geoip/ 还可以帮助为开源或 nginx plus

设置 geoip

编辑:GeoIP 已弃用,但仍可用于现有安装。

您可以在此处 https://github.com/leev/ngx_http_geoip2_module 使用 nginx 以与以前类似的方式从源构建 GeoIP2

这是较新的geoip2数据库Geolite2 Country