This repository sets up a Docker-based environment for an IP Lookup API with Nginx, PHP-FPM, and GeoIP Update for automatic GeoIP database updates from MaxMind.
Before you start, make sure you have Docker and Docker Compose installed on your system.
To update GeoIP databases automatically, you need a license key from MaxMind. Follow these steps:
- Visit MaxMind's website and create an account.
- Follow the instructions to obtain a license key: https://dev.maxmind.com/geoip/updating-databases#2-obtain-geoipconf-with-account-information
- Create a
.env
file in the root directory with your credentials:
GEOIPUPDATE_ACCOUNT_ID=your_account_id
GEOIPUPDATE_LICENSE_KEY=your_license_key
GEOIPUPDATE_EDITION_IDS=GeoLite2-ASN GeoLite2-City GeoLite2-Country
GEOIPUPDATE_FREQUENCY=72 # in hours
Replace your_account_id
and your_license_key
with your actual account details.
Launch the services using Docker Compose:
docker-compose up -d
This command starts Nginx, PHP-FPM, and GeoIP Update container.
Access your API by navigating to:
To stop all services, use:
docker-compose down
Contributions are welcome. Please open an issue first to discuss what you would like to change.
Make sure to update tests as appropriate.