nginx-mod-http-geoip
samnang rosady

samnang rosady @medrix

About: 👨‍💻 Fullstack dev by day, 🌃 IT server whisperer by night | Sharing my knowledge on frontend, backend, devops, and even a sprinkle of infrastructure.

Location:
Phnom Penh, Cambodia
Joined:
Jul 12, 2024

nginx-mod-http-geoip

Publish Date: Jan 15
0 0

nginx-mod-http-geoip

nginx-mod-http-geoip is an nginx module that allows you to determine the geographical location of an IP address. The geo of country is presented by Alpha-2 code.

You can find ISO ISO’s full, searchable list of all country codes to find your code.

map $geoip_country_code $allowed_country {
  default no;
  RU yes; # <ISO 3166-1 alpha-2> <yes/no>
}

server {
  ...
  if ($allowed_country = no) {
    return 403;
  }
  ...
}
Enter fullscreen mode Exit fullscreen mode

GitHub Sample Repository 🐳

Enjoy you practice 🌟

Comments 0 total

    Add comment