Configuration with GeoIP module

It does not include it by default. To compile it in:
Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/nginx
cp -p configure/nginx/configure.nginx custom/nginx/configure.nginx
perl -pi -e 's#"--group=nginx" \\#"--group=nginx" \\\n\t"--with-http_geoip_module" \\#' custom/nginx/configure.nginx
./build nginx

Don't forget to configure the module :) You can do that in /etc/nginx/nginx-includes.conf.
 
That sounds easy enough. Thank you for the quick reply - very much appreciated.
 
Hm, do have one more question. I do intend to use nginx_apache (installing it right now, in fact). I suppose the procedure would be different than the one for nginx above?

Thanks again!
 
To compile GeoIP into nginx as reverse proxy:
Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/nginx_reverse
cp -p configure/nginx_reverse/configure.nginx custom/nginx_reverse/configure.nginx
perl -pi -e 's#"--group=nginx" \\#"--group=nginx" \\\n\t"--with-http_geoip_module" \\#' custom/nginx_reverse/configure.nginx
./build nginx
 
Thanks! For my own reference as well for others, here is how it went:

- The script terminated telling me that it cannot proceed unless nginx is activated in the config-file. So I went ahead and activated the nginx_apache option.

- The script terminated a second time because it was missing GeoIP libraries. Running the following on my Centos7 machine did the trick:
yum install GeoIP GeoIP-devel

- After that, install went fine, but at the end there was an error stating that nginx couldn't be started.

- Went again and activated nginx_apache according to these instructions: http://forum.directadmin.com/showthread.php?t=49438

Nginx is now up and running fine. GeoIP hasn't been tested yet, and it will likely take at least a week or two until I get around to it. If there's no follow-up by me, it means everything went well and I ran off happily into the sunset. ;)
 
I am afraid I tried about any and all instructions I could find on the web, but no luck.

- nginx -V confirms that nginx is indeed compiled --with-http_geoip_module

- put this in /etc/nginx/nginx-includes.conf:

Code:
    # SET the path to the .dat file used for determining the visitor's country from the IP-address ###
    geoip_country /usr/share/GeoIP/GeoIP.dat;

    # SET the path to the .dat file used for determining the visitor's country from the IP-address ###
    geoip_city /usr/share/GeoIP/GeoLiteCity.dat;
- added this to /etc/nginx/fastcgi_params
Code:
# Set php-fpm geoip variables
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_CITY $geoip_city;
fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
fastcgi_param GEOIP_LATITUDE $geoip_latitude;
fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
- added this to /etc/nginx/nginxproxy.conf
Code:
### SET GEOIP Variables ###
proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
proxy_set_header GEOIP_COUNTRY_CODE3 $geoip_country_code3;
proxy_set_header GEOIP_COUNTRY_NAME $geoip_country_name;

proxy_set_header GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
proxy_set_header GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
proxy_set_header GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
proxy_set_header GEOIP_REGION $geoip_region;
proxy_set_header GEOIP_CITY $geoip_city;
proxy_set_header GEOIP_POSTAL_CODE $geoip_postal_code;
proxy_set_header GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
proxy_set_header GEOIP_LATITUDE $geoip_latitude;
proxy_set_header GEOIP_LONGITUDE $geoip_longitude;
Restarted nginx, php-fpm56, httpd, rebooted - nothing.

The problem (or probably the symptom rather) is that GeoIP $_SERVER variables remain empty.

I ended up putting stuff in /etc/httpd/conf/extra/httpd-nginx.conf as well, but that didn't make any difference either.

Any help greatly appreciated!
 
Back
Top