Question

--with-http_geoip_module not showing on my configure arguments

I need help on understanding how to configure geoip module on nginx web server, I’m using Centos 6.7 final.

This is the result of nginx -V

configure arguments: --user=nginx --group=nginx --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_realip_module --without-http_scgi_module --without-http_uwsgi_module --without-http_fastcgi_module

I already did ./configure --with-http_geoip_module make && make install

The result is: make -f objs/Makefile make[1]: Entering directory /nginx-1.12.1' make[1]: Nothing to be done for build’. make[1]: Leaving directory /nginx-1.12.1' make -f objs/Makefile install make[1]: Entering directory /nginx-1.12.1’ test -d ‘/usr/local/nginx’ || mkdir -p ‘/usr/local/nginx’ test -d ‘/usr/local/nginx/sbin’
|| mkdir -p ‘/usr/local/nginx/sbin’ test ! -f ‘/usr/local/nginx/sbin/nginx’
|| mv ‘/usr/local/nginx/sbin/nginx’
‘/usr/local/nginx/sbin/nginx.old’ cp objs/nginx ‘/usr/local/nginx/sbin/nginx’ test -d ‘/usr/local/nginx/conf’
|| mkdir -p ‘/usr/local/nginx/conf’ cp conf/koi-win ‘/usr/local/nginx/conf’ cp conf/koi-utf ‘/usr/local/nginx/conf’ cp conf/win-utf ‘/usr/local/nginx/conf’ test -f ‘/usr/local/nginx/conf/mime.types’
|| cp conf/mime.types ‘/usr/local/nginx/conf’ cp conf/mime.types ‘/usr/local/nginx/conf/mime.types.default’ test -f ‘/usr/local/nginx/conf/fastcgi_params’
|| cp conf/fastcgi_params ‘/usr/local/nginx/conf’ cp conf/fastcgi_params
‘/usr/local/nginx/conf/fastcgi_params.default’ test -f ‘/usr/local/nginx/conf/fastcgi.conf’
|| cp conf/fastcgi.conf ‘/usr/local/nginx/conf’ cp conf/fastcgi.conf ‘/usr/local/nginx/conf/fastcgi.conf.default’ test -f ‘/usr/local/nginx/conf/uwsgi_params’
|| cp conf/uwsgi_params ‘/usr/local/nginx/conf’ cp conf/uwsgi_params
‘/usr/local/nginx/conf/uwsgi_params.default’ test -f ‘/usr/local/nginx/conf/scgi_params’
|| cp conf/scgi_params ‘/usr/local/nginx/conf’ cp conf/scgi_params
‘/usr/local/nginx/conf/scgi_params.default’ test -f ‘/usr/local/nginx/conf/nginx.conf’
|| cp conf/nginx.conf ‘/usr/local/nginx/conf/nginx.conf’ cp conf/nginx.conf ‘/usr/local/nginx/conf/nginx.conf.default’ test -d ‘/usr/local/nginx/logs’
|| mkdir -p ‘/usr/local/nginx/logs’ test -d ‘/usr/local/nginx/logs’
|| mkdir -p ‘/usr/local/nginx/logs’ test -d ‘/usr/local/nginx/html’
|| cp -R html ‘/usr/local/nginx’ test -d ‘/usr/local/nginx/logs’
|| mkdir -p ‘/usr/local/nginx/logs’ make[1]: Leaving directory `/nginx-1.12.1’

Checked again the nginx -V. --with_http_geoip_module is still not showing on configure argumets.

How do I know if the module is already loaded?

Subscribe
Share

Hi @hansen,

I guess its been loaded now. I tried to compile it inside nginx ./configure folder. My problem now is geoip_city is not working tho I checked geoip_country_code and it seems no problem.

http {
	geoip_country  /usr/local/share/GeoIP/GeoIP.dat;
	geoip_city     /usr/local/share/GeoIP/GeoLiteCity.dat;

	// Working
	map $geoip_country_code $not_allowed_country {
        default no;
        US yes;
    }

	// Not working
	map $geoip_city $not_allowed_city {
        default no;
        Shanghai yes;
    }
}

server {
	if ($not_allowed_city = yes) {
        rewrite ^/(.*)$ https://myurl.com redirect;
    }
}

I also did nginx -t, and the result is successful. I have no idea why geoip_city is not working.

@jtittle Do you have one of your compile instructions handy, so you can help with this?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.