I’m currently using NginX on my Server and i want to block some countries from visiting my website. Can anyone help me please?
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!
Hi all, I used this method to block access to /wp-admin location from all countries except some preferred.
location /wp-admin {
if ($allowed_country = no) {
return 403;
}
}
It works fine when trying to open this page in browser. But still I can see in access.log many POST requests and in worpdress logs failed login requests from rejected countries. Is possible to use geoip-database-contrib module also for POST requests?
I tried:
location /wp-admin {
if ($allowed_country = no) {
deny all;
}
}
but after reload nginx doesnt start at all. Do you have any ideas?
Your site is exactly what I have looking for!! It certainly helps a frequent traveler like me to locate all the stamp shows when traveling. Keep up with the good work.
This comment has been deleted
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.