Nginx geo ip module not working, cannot find a way to debug

I am following the nginx geoip configuration guide here http://www.howtoforge.com/nginx-how-to-block-visitors-by-country-with-the-geoip-module-debian-ubuntu

I am writing something like this

geoip_country /path/to/GeoIP.dat;

      

I'm pretty sure the .dat file is there and nginx has permission to access it. However, the variable geoip_country_code

seems to be unset.

I have tried many approaches to debugging like

add_header X-debug-message "$geoip_country_code";

      

or

log_format debug "$geoip_country_code"

      

for the header, nginx returns an empty result. And for the log format, it just doesn't write anything. My bet is geoip_country_code is not even defined, so nginx can't handle it or what.

I tried to read the server error log, however there is nothing there (nothing about geoip and the undefined variable). This is annoying, how can I find out what is going on with nginx and the geoip module?

+3


source to share


1 answer


After looking in the syslog, I noticed that it is a segfault in the geoip module

Aug 10 12:55:39 web kernel: [1183521.905522] nginx[30201]: segfault at 7fa773b7f2ce ip 00007fa772bc5478 sp 00007fffe4adc570 error 4 in libGeoIP.so.1.6.0[7fa772bbe000+2d000]

      



So I'm pretty sure this is caused by either the geoip module or a corrupted GeoIP.dat file. After looking at the file, I found that it was corrupted. Then I upload the file again, now everything works fine.

+2


source







All Articles