Take the 2-minute tour ×

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? –  stefpet Mar 26 '12 at 20:00

2 Answers 2

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


