By chris730976
Hello. Can you help me block specific countries from accessing my website.
Thank you.
Sincerely,
Chris Anthony
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Why? What are you trying to accomplish by doing this? How are you going to determine the “country” of an IP? These questions can change the answer completely.
How detailed do you want the list. If you want to do mass blocking you could use https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml
For instance if you want to block all APNIC (Asia Pacific ips) firewall off all the APNIC /8 entries.
http://www.ip2location.com/free/visitor-blocker lets you do it by country but that take a lot of time to compile a list unless you are targeting only a couple countries.
Of course they could always use a proxy to bypass this.
I recommend you setting up your website with Cloudflare, I believe that they have a feature that allows you to block certain countries from accessing your website.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.