Home  >  Q&A  >  body text

linux - 在lnmp环境中,我想把网站屏蔽某些国家的ip地址访问,请问用什么方法?

PHP中文网PHP中文网2712 days ago419

reply all(4)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 16:07:33

    http://www.vpsee.com/2011/03/...

    Now that nginx installed through the distribution version may have integrated the geoip module, the first step is not needed. The distribution may also have packaged the GeoIP database, so you don't need to create it yourself. You still have to read the instructions in the release version for details.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 16:07:33

    Two ideas:

    1. Based on iptables, but first you need to know the IP range

    2. Program level control, get the access IP and then query the IP library.
      The specific method is quite simple, you can look up the information by yourself.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:07:33

    If you find it troublesome to block IPs, why not think differently.
    Using Amou Cloud’s intelligent cloud resolution, domain name resolution is not provided for certain countries or regions.

    reply
    0
  • 迷茫

    迷茫2017-04-17 16:07:33

    The first step is to introduce a judgment function module. This function module compares with the latest IP library. Once the Russian and American IPs are found, it will jump to other websites or display a fake 404 page. Perform normal entry when it is not the above IP.

    reply
    0
  • Cancelreply