问题描述
该笔记将记录:在 Nginx 中,如何屏蔽某些 IP 地址对站点的访问,以及相关问题解决方法。
解决方案
这里我们还是会记录如何通过 IP 地址进行屏蔽:
server { server blog.example.com; deny 45.43.23.21; deny 45.43.23.0/24; allow all; ... # 针对地址进行屏蔽 location /accounts/login { deny 45.43.23.21; } }
参考文献
GeoIP Legacy Databases
geoip – How to Convert a Maxmind .MMDB to .DAT? – Stack Overflow
nginx: How To Block Visitors By Country With The GeoIP Module (Debian/Ubuntu)
Module ngx_http_geoip_module
Installing Nginx with GeoIP2 on Ubuntu | Ivan Dokov – Software architect and strategist