- Make sure you have EPEL and nginx-mainline repositories are added and enabled in your system (*)
- Execute yum install nginx-module-geoip command
- put this line on the top of your /etc/nginx/nginx.conf:
- test your configuration with nginx -t command
- If no errors happen, reload nginx with nginx -s reload
That's it! You can immediately use the GeoIP module within nginx on your CentOS server.
(*) To use nginx-mainline repo, put the following to /etc/yum.repos.d/nginx.repo:
Note that we have gpgcheck=1 (official docs suggest we use gpgcheck=0, but that seems to be incorrect).
It is possible that you will have to update your packages to get the latest nginx release.
(*) If you don not have EPEL yet, you can enable it with yum install epel-release