Tagged articles
3 articles
Page 1 of 1
Architect's Guide
Architect's Guide
Apr 10, 2026 · Operations

How to Block Foreign IPs with NGINX and the ngx_http_geoip2 Module

This step‑by‑step guide shows how to install the GeoIP2 library, compile NGINX 1.18 with the ngx_http_geoip2 module, download the latest MaxMind GeoLite2 database, configure geoip2 directives, and verify that foreign IP requests are blocked with a 404 response.

Server Securityblock foreign IPgeoip2
0 likes · 7 min read
How to Block Foreign IPs with NGINX and the ngx_http_geoip2 Module
MaGe Linux Operations
MaGe Linux Operations
Feb 27, 2023 · Backend Development

How to Block Foreign IPs in Nginx Using the GeoIP2 Module

This step‑by‑step guide shows how to install the GeoIP2 library, upgrade Nginx, compile the ngx_http_geoip2 module, download the MaxMind GeoLite2 database, configure nginx.conf to detect non‑Chinese IPs, and return a 404 response to block foreign visitors.

Server Securityblock foreign IPconfiguration
0 likes · 8 min read
How to Block Foreign IPs in Nginx Using the GeoIP2 Module
MaGe Linux Operations
MaGe Linux Operations
May 9, 2021 · Information Security

How to Block Foreign IPs in Nginx Using the ngx_http_geoip2 Module

This guide walks you through installing the ngx_http_geoip2 module, upgrading Nginx, downloading the GeoLite2 database, configuring Nginx to detect foreign IPs, and applying rules that return a 404 response for non‑Chinese visitors, complete with command‑line examples and verification steps.

Information SecurityServer Configurationblock foreign IP
0 likes · 7 min read
How to Block Foreign IPs in Nginx Using the ngx_http_geoip2 Module