What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a new NGINX deployment, use the GeoIP2 module with a current MaxMind GeoIP2 or GeoLite2 .mmdb database. The older GeoIP module works with discontinued GeoLite Legacy databases, so it is not the right starting point for new geolocation lookups. The basic setup is to load the GeoIP2 module, map database fields to NGINX variables, make sure NGINX sees the real client IP, then test and reload the configuration.

Choose GeoIP2, not GeoLite Legacy

NGINX’s legacy GeoIP module uses precompiled MaxMind databases, and NGINX notes that GeoLite Legacy is discontinued. For a current setup, use the GeoIP2 module with a MaxMind GeoIP2 or GeoLite2 database in MMDB format. See NGINX’s legacy GeoIP module reference and its GeoIP2 module guide.

Choose the database scope according to the result you need. Country data is enough for country-level routing or reporting; use City data when you need fields such as city, subdivision, or coordinates. MaxMind describes MMDB as a binary format for fast application lookups; its CSV data is intended for tasks such as transformation or SQL import. See MaxMind’s database-format information.

Install and enable the GeoIP2 module

Install a GeoIP2 module package compatible with your NGINX distribution and version. NGINX Plus documents platform-specific package installation, including yum, dnf, apt, apk, and FreeBSD package variants; open-source NGINX users should verify whether their build includes the community module or requires a separate dynamic module. See the NGINX GeoIP2 installation guide and the community module documentation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
TP-Link AC1200 Gigabit Dual Band WiFi Router (Archer A6)
  • Dual band router upgrades to 1200 Mbps high speed internet (300mbps for 2.4GHz plus 900Mbps for 5GHz), reducing buffering and ideal for 4K stream
  • Full Gigabit Ports - Gigabit Router with 4 Gigabit LAN ports, ideal for any internet plan and allow you to directly connect your wired devices
  • Boosted Coverage - Four external antennas equipped with Beamforming technology extend and concentrate the Wi-Fi signals
  • MU-MIMO technology - (5GHz band) allows high speeds for multiple devices simultaneously
  • Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home

Download the MMDB files from MaxMind and place them at stable paths readable by the NGINX worker processes. If you use a dynamic module, load its shared object at the main configuration level, outside the http {} block. The module file’s actual path can differ by package.

load_module modules/ngx_http_geoip2_module.so;

Map database fields to NGINX variables

Put geoip2 blocks inside http {} for HTTP traffic. Each directive inside a block declares an NGINX variable and the corresponding MMDB field path. This example maps common country and city fields:

http {
    geoip2 /var/lib/GeoIP/GeoLite2-Country.mmdb {
        $geoip2_country_code country iso_code;
        $geoip2_country_name country names en;
    }

    geoip2 /var/lib/GeoIP/GeoLite2-City.mmdb {
        $geoip2_city_name city names en;
        $geoip2_region_code subdivisions 0 iso_code;
        $geoip2_latitude location latitude;
        $geoip2_longitude location longitude;
    }

    log_format main '$remote_addr country=$geoip2_country_code city=$geoip2_city_name';
}

Field paths are database lookups, not universal labels: for example, country iso_code returns the country code, while subdivisions 0 iso_code addresses the first subdivision entry. Confirm that a field exists in the exact database you installed before relying on it. NGINX’s guide demonstrates checking paths with mmdblookup; for example:

Rank #2
Sale
TP-Link ER605, Wired Gigabit VPN Router
  • 【Five Gigabit Ports】1 Gigabit WAN Port plus 2 Gigabit WAN/LAN Ports plus 2 Gigabit LAN Port. Up to 3 WAN ports optimize bandwidth usage through one device.
  • 【One USB WAN Port】Mobile broadband via 4G/3G modem is supported for WAN backup by connecting to the USB port. For complete list of compatible 4G/3G modems, please visit TP-Link website.
  • 【Abundant Security Features】Advanced firewall policies, DoS defense, IP/MAC/URL filtering, speed test and more security functions protect your network and data.
  • 【Highly Secure VPN】Supports up to 20× LAN-to-LAN IPsec, 16× OpenVPN, 16× L2TP, and 16× PPTP VPN connections.
  • Security - SPI Firewall, VPN Pass through, FTP/H.323/PPTP/SIP/IPsec ALG, DoS Defence, Ping of Death and Local Management. Standards and Protocols IEEE 802.3, 802.3u, 802.3ab, IEEE 802.3x, IEEE 802.1q
mmdblookup --file /var/lib/GeoIP/GeoLite2-Country.mmdb --ip 8.8.8.8

Use the appropriate field path arguments for the value you want to inspect. The community module also documents options such as source=$variable, default=..., metadata variables, and auto_reload. These options depend on the installed module build, so check its documentation and version before adding them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make sure GeoIP2 receives the visitor’s IP

By default, a lookup uses the address NGINX sees. When traffic passes through a reverse proxy or load balancer, that may be the proxy’s address rather than the visitor’s. Configure NGINX’s real-IP handling for the proxy addresses you control before using GeoIP2, then log the resulting client address alongside the lookup variables to check that both are plausible.

For example, use the real-IP module’s trusted-proxy directives with the actual CIDRs of your infrastructure; do not trust forwarding headers from arbitrary clients. If the community GeoIP2 module is configured with source=$variable, point it at the client-address variable populated by real-IP processing. The legacy GeoIP reference documents geoip_proxy and geoip_proxy_recursive; recursive handling walks a forwarded list to the last non-trusted address. See NGINX’s GeoIP reference and the GeoIP2 module documentation for the module-specific behavior.

Rank #3
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54)
  • Dual-band Wi-Fi with 5 GHz speeds up to 867 Mbps and 2.4 GHz speeds up to 300 Mbps, delivering 1200 Mbps of total bandwidth¹. Dual-band routers do not support 6 GHz. Performance varies by conditions, distance to devices, and obstacles such as walls.
  • Covers up to 1,000 sq. ft. with four external antennas for stable wireless connections and optimal coverage.
  • Supports IGMP Proxy/Snooping, Bridge and Tag VLAN to optimize IPTV streaming
  • Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home
  • Advanced Security with WPA3 - The latest Wi-Fi security protocol, WPA3, brings new capabilities to improve cybersecurity in personal networks

Test, reload, and verify the result

  1. Run nginx -t to check configuration syntax and whether NGINX can read the module and database paths.

  2. If the test succeeds, reload NGINX with nginx -s reload.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Make a request through the normal traffic path and inspect a log format that includes the client address and GeoIP variables. Check that proxy traffic resolves against the visitor address rather than the proxy address.

    Rank #4
    Sale
    TP-Link AX1800 WiFi 6 Router (Archer AX21 V5)
    • DUAL-BAND WIFI 6 ROUTER: Wi-Fi 6(802.11ax) technology achieves faster speeds, greater capacity and reduced network congestion compared to the previous gen. All WiFi routers require a separate modem. Dual-Band WiFi routers do not support the 6 GHz band.
    • AX1800: Enjoy smoother and more stable streaming, gaming, downloading with 1.8 Gbps total bandwidth (up to 1200 Mbps on 5 GHz and up to 574 Mbps on 2.4 GHz). Performance varies by conditions, distance to devices, and obstacles such as walls.
    • CONNECT MORE DEVICES: Wi-Fi 6 technology communicates more data to more devices simultaneously using revolutionary OFDMA technology
    • EXTENSIVE COVERAGE: Achieve the strong, reliable WiFi coverage with Archer AX1800 as it focuses signal strength to your devices far away using Beamforming technology, 4 high-gain antennas and an advanced front-end module (FEM) chipset
    • OUR CYBERSECURITY COMMITMENT: TP-Link is a signatory of the U.S. Cybersecurity and Infrastructure Security Agency’s (CISA) Secure-by-Design pledge. This device is designed, built, and maintained, with advanced security as a core requirement.
  4. If a variable is empty, confirm that the database contains that field for the test IP, that the field path is correct, and that the NGINX worker can read the database file. Missing fields are normal; give application logic a deliberate fallback rather than assuming every lookup returns a value.

For stream traffic, configure the module in the relevant stream {} context if the installed module supports it. Do not copy HTTP-context directives into stream configuration without checking the module’s syntax for that build.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep MMDB files current

MaxMind recommends automating GeoIP and GeoLite database updates because stale data can become less accurate. Its GeoIP Update program automates binary database downloads and authenticates with an account ID and active license key. Keep the key out of NGINX configuration and protect it like a password. See MaxMind’s GeoIP Update documentation and its GeoLite update policy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
TP-Link Dual-Band AX3000 Wi-Fi 6 Wireless Gigabit Internet Router for Home
  • Next-Gen Gigabit Wi-Fi 6 Speeds: 2402 Mbps on 5 GHz and 574 Mbps on 2.4 GHz bands ensure smoother streaming and faster downloads; support VPN server and VPN client¹
  • A More Responsive Experience: Enjoy smooth gaming, video streaming, and live feeds simultaneously. OFDMA makes your Wi-Fi stronger by allowing multiple clients to share one band at the same time, cutting latency and jitter.²
  • Expanded Wi-Fi Coverage: 4 high-gain external antennas and Beamforming technology combine to extend strong, reliable, Wi-Fi throughout your home.
  • Improved Battery Life: Target Wake Time helps your devices to communicate efficiently while consuming less power.
  • Improved Cooling Design: No heat ups, no throttles. A larger heat sink and redefined case design cools the WiFi 6 system and enables your network to stay at top speeds in more versatile environments.

MaxMind’s current GeoLite documentation limits users to 30 database downloads per day and requires users to delete a database within 30 days of a new release. GeoIP Update 4.x and later meet MaxMind’s TLS 1.2-or-greater requirement for requests. Check the current MaxMind documentation for applicable account and update requirements.

After replacing an MMDB file, reload NGINX or use a supported module auto-reload feature. The community GeoIP2 module documents auto_reload and metadata fields for the last check or change; confirm that the exact module build you run supports the behavior you need.

Use geolocation carefully and within the license

IP geolocation is an approximation based on IP allocation, not a precise physical-location signal. City, region, and coordinate fields should not be presented as proof of where a person is. Database fields can also change over time, so handle absent values and avoid depending on an unverified fixed schema.

MaxMind’s site-license overview permits certain internal, restricted business uses, such as content customization, fraud prevention, and geographic reporting. Sharing or redistributing GeoIP data or geolocation pairings with third parties may require different rights. Check the MaxMind license terms for your use case; obtain an appropriate commercial or redistribution license, or use a suitable MaxMind service, when your application serves third parties.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
TP-Link AC1200 Gigabit Dual Band WiFi Router (Archer A6)
TP-Link AC1200 Gigabit Dual Band WiFi Router (Archer A6)
MU-MIMO technology - (5GHz band) allows high speeds for multiple devices simultaneously
$44.99
SaleBestseller No. 2
Bestseller No. 3
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54)
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54)
Supports IGMP Proxy/Snooping, Bridge and Tag VLAN to optimize IPTV streaming
$34.99
SaleBestseller No. 4
TP-Link AX1800 WiFi 6 Router (Archer AX21 V5)
TP-Link AX1800 WiFi 6 Router (Archer AX21 V5)
VPN SERVER: Archer AX21 Supports both Open VPN Server and PPTP VPN Server
$69.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.