Home > Operation and Maintenance > Nginx > What is the use of nginx's GeoIP?

What is the use of nginx's GeoIP?

(*-*)浩
Release: 2019-12-21 15:42:02
Original
4303 people have browsed it

What is the use of nginx's GeoIP?

The GeoIP module in Nginx can block requests for specified IPs, but it is not compiled by default. After opening it, we only need to download another IP rule and configure it in the Nginx server GeoIP module to intercept specified country IP.                                                                                                                                                                                                                                                       ​ I took the time to research this information. The best method found so far is to use Nginx's GeoIP module to achieve region identification. Then configure the ISO name of the relevant country and prohibit access. Record the relevant process. Compile the GeoIP component

The free version of the database provided by maxmind can already meet the needs. Before using the database, you need to compile the GeoIP component first:

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.8.tar.gz
./configure
make
make install
Copy after login
Download IP library

Download the IP packet from maxmind and unzip it. This is the country’s ip data packet:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
Copy after login
This is the city’s ip data packet:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
Copy after login

After executing the above command, you will get GeoIP.dat and GeoLiteCity .dat files. Copy these two files to Nginx's conf directory.

The above is the detailed content of What is the use of nginx's GeoIP?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template