{"id":18318540,"url":"https://github.com/maxmind/mod_maxminddb","last_synced_at":"2025-04-05T11:08:13.659Z","repository":{"id":9691511,"uuid":"11638986","full_name":"maxmind/mod_maxminddb","owner":"maxmind","description":"MaxMind DB Apache Module","archived":false,"fork":false,"pushed_at":"2025-03-21T19:05:11.000Z","size":298,"stargazers_count":135,"open_issues_count":5,"forks_count":29,"subscribers_count":32,"default_branch":"main","last_synced_at":"2025-03-29T10:05:54.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://maxmind.github.io/mod_maxminddb/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxmind.png","metadata":{"files":{"readme":"README.md","changelog":"Changes.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-24T15:59:17.000Z","updated_at":"2025-03-27T13:12:28.000Z","dependencies_parsed_at":"2024-06-21T08:26:33.318Z","dependency_job_id":"ecd2e2c1-65a4-4c8b-8b44-83aca8ded262","html_url":"https://github.com/maxmind/mod_maxminddb","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fmod_maxminddb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fmod_maxminddb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fmod_maxminddb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2Fmod_maxminddb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxmind","download_url":"https://codeload.github.com/maxmind/mod_maxminddb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:09:57.708Z","updated_at":"2025-04-05T11:08:13.634Z","avatar_url":"https://github.com/maxmind.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MaxMind DB Apache Module #\n\nThis module allows you to query MaxMind DB files from Apache 2.2+ using the\n`libmaxminddb` library.\n\n## Requirements ##\n\nThis module requires Apache 2.2 or 2.4 to be installed, including any\ncorresponding \"dev\" package, such as `apache2-dev` on Ubuntu. You should have\n`apxs` or `apxs2` in your `$PATH`.\n\nYou also must install the [libmaxminddb](https://github.com/maxmind/libmaxminddb)\nC library.\n\n## Installation ##\n\n### From a Named Release Tarball (Recommended) ###\n\n**NOTE:** These instructions are for installation from the _named_ `.tar.gz`\ntarballs on the [Releases](https://github.com/maxmind/mod_maxminddb/releases)\npage (e.g. `mod_maxminddb-*.tar.gz`).\n\nTo install the module from a tarball, run the following commands from the\ndirectory with the extracted source:\n\n    ./configure\n    make install\n\nTo use another Apache installation, specify a path to the right apxs binary:\n\n    ./configure --with-apxs=/foo/bar/apxs\n\n### From a GitHub \"Source Code\" Archive / Git Repo Clone (Achtung!) ###\n\n**NOTE:** These instructions are for installation from the GitHub \"Source\nCode\" archives also available on the\n[Releases](https://github.com/maxmind/mod_maxminddb/releases) page (e.g.\n`X.Y.Z.zip` or `X.Y.Z.tar.gz`), as well as installation directly from a clone\nof the Git repo. Installation from these sources are possible but will\npresent challenges to users not comfortable with manual dependency resolution.\n\n1. Ensure the build tools `automake`, `autoconf` and `libtool` are installed.\n2. Extract the archive and switch into the directory containing the extracted\n   source.\n3. Run `./bootstrap`. Many users will experience challenges here as there are\n   several dependencies that need to be present before this can complete\n   successfully.\n4. Run:\n\n        ./configure\n        make install\n\nTo use another Apache installation, specify a path to the right apxs binary:\n\n    ./configure --with-apxs=/foo/bar/apxs\n\n## Loading the Module ##\n\nAfter installing the module, Apache has to load it. Note the installation\ndoes this automatically, so you should not need to do anything. If you're\nunsure if the module is loaded, ensure there's a `LoadModule` line\nsomewhere in your config, such as `LoadModule maxminddb_module\n/path/to/mod_maxminddb.so`.\n\n## Usage ##\n\nTo use this module, you must first download or create a MaxMind DB file. We\nprovide [free GeoLite2 databases](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data?lang=en)\nas well as [commercial GeoIP2 databases](https://www.maxmind.com/en/geoip2-databases).\n\nAfter installing this module and obtaining a database, you must now set up the\nmodule in your Apache configuration file (e.g., `/etc/apache2/apache2.conf`)\nor in an `.htaccess` file. You must set `MaxMindDBEnable` to enable the\nmodule, `MaxMindDBFile` to specify the database to use, and `MaxMindDBEnv` to\nbind the desired lookup result to an environment variable.\nYou can also enable `MaxMindDBSetNotes` if you wish the environment variables\nto also be set as Apache notes.\n\nThis module uses the client IP address for the lookup. This is not always what\nyou want. If you need to use an IP address specified in a header (e.g., by\nyour proxy frontend),\n[mod_remoteip](https://httpd.apache.org/docs/current/mod/mod_remoteip.html) may\nbe used to set the client IP address.\n\nManually setting the client IP address is also possible. See\n[Client IP address lookup control](#client-ip-address-lookup-control).\n\n## Directives ##\n\nAll directives may appear either in your server configuration or an\n`.htaccess` file. Directives in `\u003cLocation\u003e` and `\u003cDirectory\u003e` blocks will\nalso apply to sub-locations and subdirectories. The configuration will be\nmerged with the most specific taking precedence. For instance, a conflicting\ndirective set for a subdirectory will be used for the subdirectory rather\nthan the directive set for the parent location.\n\nSimilarly, the main server configuration may set defaults that will be merged\ninto the configuration provided by individual virtual hosts. However, please\nnote that currently no configuration merging is performed between server/vhost\nand directory configurations.\n\n### `MaxMindDBEnable` ###\n\nThis directive enables or disables the MaxMind DB lookup. Valid settings are\n`On` and `Off`.\n\n    MaxMindDBEnable On\n\n### `MaxMindDBFile` ###\n\nThis directive associates a name placeholder with a MaxMind DB file on the\ndisk. You may specify multiple databases, each with its own name.\n\n    MaxMindDBFile COUNTRY_DB /usr/local/share/GeoIP/GeoLite2-Country.mmdb\n    MaxMindDBFile CITY_DB    /usr/local/share/GeoIP/GeoLite2-City.mmdb\n\nThe name placeholder can be any string that Apache parses as a word. We\nrecommend sticking to letters, numbers, and underscores.\n\n### `MaxMindDBEnv` ###\n\nThis directive assigns the lookup result to an environment variable. The first\nparameter after the directive is the environment variable. The second\nparameter is the name of the database followed by the path to the desired data\nusing map keys or 0-based array indexes separated by `/`.\n\n    MaxMindDBEnv COUNTRY_CODE COUNTRY_DB/country/iso_code\n    MaxMindDBEnv REGION_CODE  CITY_DB/subdivisions/0/iso_code\n\nKeep in mind that the configured environment variable(s) will only be exported if the data lookup succeeds.\n\n### `MaxMindDBNetworkEnv` ###\n\nThis directive assigns the network associated with the IP address to an\nenvironment variable. The network will be in CIDR format. This directive\nmay only be used once per database.\n\n    MaxMindDBNetworkEnv COUNTRY_DB COUNTRY_NETWORK\n    MaxMindDBNetworkEnv CITY_DB    CITY_NETWORK\n\n### `MaxMindDBSetNotes` ###\n\nThis directive enables or disables the setting of Apache notes alongside the\nenvironment variables set via `MaxMindDBEnv`. Valid settings are `On` and `Off`.\nIt defaults to `Off`.\n\n    MaxMindDBSetNotes On\n\n## Exported Environment Variables ##\n\nIn addition to the environment variable specified by `MaxMindDBEnv`, this\nmodule exports `MMDB_ADDR`, which contains the IP address used for lookups by\nthe module. This is primarily intended for debugging purposes.\nIf `MaxMindDBSetNotes` is `On`, all environment variables are also exported as\nApache notes.\n\n## Client IP address lookup control ##\n\nIn case you want supply your own value for the IP address to lookup, it may be\ndone by setting the environment variable `MMDB_ADDR`.\nThis can be done, for instance, with\n[ModSecurity](https://github.com/SpiderLabs/ModSecurity/) in (real) phase 1.\nNote that mod_setenvif and mod_rewrite cannot be used for this as they are\nrunning after this module. For most usages,\n[mod_remoteip](https://httpd.apache.org/docs/current/mod/mod_remoteip.html)\nis an easier alternative.\n\n## Examples ##\n\nThese examples show how to export data from the database into environment\nvariables.\n\n### ASN Database ###\n\n    \u003cIfModule mod_maxminddb.c\u003e\n        MaxMindDBEnable On\n        MaxMindDBFile ASN_DB /usr/local/share/GeoIP/GeoLite2-ASN.mmdb\n\n        MaxMindDBEnv MM_ASN ASN_DB/autonomous_system_number\n        MaxMindDBEnv MM_ASORG ASN_DB/autonomous_system_organization\n\n        MaxMindDBNetworkEnv ASN_DB ASN_DB_NETWORK\n    \u003c/IfModule\u003e\n\n### City Database ###\n\n    \u003cIfModule mod_maxminddb.c\u003e\n        MaxMindDBEnable On\n        MaxMindDBFile CITY_DB /usr/local/share/GeoIP/GeoLite2-City.mmdb\n\n        MaxMindDBEnv MM_COUNTRY_CODE CITY_DB/country/iso_code\n        MaxMindDBEnv MM_COUNTRY_NAME CITY_DB/country/names/en\n        MaxMindDBEnv MM_CITY_NAME CITY_DB/city/names/en\n        MaxMindDBEnv MM_LONGITUDE CITY_DB/location/longitude\n        MaxMindDBEnv MM_LATITUDE CITY_DB/location/latitude\n\n        MaxMindDBNetworkEnv CITY_DB CITY_DB_NETWORK\n    \u003c/IfModule\u003e\n\n### Connection-Type Database ###\n\n    \u003cIfModule mod_maxminddb.c\u003e\n        MaxMindDBEnable On\n        MaxMindDBFile CONNECTION_TYPE_DB /usr/local/share/GeoIP/GeoIP2-Connection-Type.mmdb\n\n        MaxMindDBEnv MM_CONNECTION_TYPE CONNECTION_TYPE_DB/connection_type\n\n        MaxMindDBNetworkEnv CONNECTION_TYPE_DB CONNECTION_TYPE_DB_NETWORK\n    \u003c/IfModule\u003e\n\n### Domain Database ###\n\n    \u003cIfModule mod_maxminddb.c\u003e\n        MaxMindDBEnable On\n        MaxMindDBFile DOMAIN_DB /usr/local/share/GeoIP/GeoIP2-Domain.mmdb\n\n        MaxMindDBEnv MM_DOMAIN DOMAIN_DB/domain\n\n        MaxMindDBNetworkEnv DOMAIN_DB DOMAIN_DB_NETWORK\n    \u003c/IfModule\u003e\n\n### ISP Database ###\n\n    \u003cIfModule mod_maxminddb.c\u003e\n        MaxMindDBEnable On\n        MaxMindDBFile ISP_DB /usr/local/share/GeoIP/GeoIP2-ISP.mmdb\n\n        MaxMindDBEnv MM_ASN ISP_DB/autonomous_system_number\n        MaxMindDBEnv MM_ASORG ISP_DB/autonomous_system_organization\n        MaxMindDBEnv MM_ISP ISP_DB/isp\n        MaxMindDBEnv MM_ORG ISP_DB/organization\n\n        MaxMindDBNetworkEnv ISP_DB ISP_DB_NETWORK\n    \u003c/IfModule\u003e\n\n### Blocking by Country ###\n\nThis example shows how to block users based on their country:\n\n    MaxMindDBEnable On\n    MaxMindDBFile COUNTRY_DB /usr/local/share/GeoIP/GeoLite2-Country.mmdb\n    MaxMindDBEnv MM_COUNTRY_CODE COUNTRY_DB/country/iso_code\n\n    SetEnvIf MM_COUNTRY_CODE ^(RU|DE|FR) BlockCountry\n    Deny from env=BlockCountry\n\nNote that at least the \"Deny\" or \"Allow\" directive (or \"Require\" directive in\nApache 2.4 and above) must be applied within a `\u003cDirectory\u003e`, `\u003cLocation\u003e` or\n`\u003cFiles\u003e` container.\n\n## Data Output Format ##\n\nAll data is provided as a string bound to the specified Apache environment\nvariable. Floating point numbers are provided to five digits after the decimal\nplace. All integers types except 128-bit integers are provided as decimal.\n128-bit integers are returned as hexadecimal. Booleans are returned as \"0\" for\nfalse and \"1\" for true.\n\nNote that data stored as the \"bytes\" type in a MaxMind DB database can contain\nnull bytes and may end up truncated when stored in an environment variable. If\nyou really need to access this data, we recommend using [one of our\nprogramming language\nAPIs](https://dev.maxmind.com/geoip/geolocate-an-ip/databases?lang=en) instead.\n\n## Support ##\n\nPlease report all issues with this code using the [GitHub issue\ntracker](https://github.com/maxmind/mod_maxminddb/issues).\n\nIf you are having an issue with a commercial MaxMind database that is not\nspecific to this module, please see [our support\npage](https://www.maxmind.com/en/support).\n\n## Versioning ##\n\nThe MaxMind DB Apache module uses [Semantic Versioning](https://semver.org/).\n\n## Copyright and License ##\n\nThis software is Copyright (c) 2013-2021 by MaxMind, Inc.\n\nThis is free software, licensed under the Apache License, Version 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2Fmod_maxminddb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxmind%2Fmod_maxminddb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2Fmod_maxminddb/lists"}