Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Because Nginx requires the geoip_ directives to go into the main http{ } block of the nginx.conf file, does that mean the geoip data is being pulled for every single request?

In other words, does NginX look up the geoip data for ALL of the requests coming in, even for those not needing the data?

share|improve this question
Also interested in an actual answer on this question. Adding this something running PHP is little overhead I assume, but also looking up every request for a site serving static content feels uneccesary. But how to avoid if the geoip directives must be specified in the http block rather than in the server block? – stpe Mar 26 '12 at 20:00

Nginx parses and loads geoip data into memory once the config file only on (re)start or SIGHUP.

What about expanding $geoip_* variables - I'm not sure, but hope they calculates only when required (in "if" or "log" or "map" or whatever construction). Anyway, it doesn't reread and reload whole dat the file each request.

share|improve this answer

GeoIP lookups come from a distributed database rather than from a dynamic server, so unlike DNS, the worst-case performance hit is minimal.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.