With nginx it's possible to block country.
On debian install the package : libnginx-mod-http-geoip
Edit /etc/nginx/nginx.conf and
#add into http directive:
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $allowed_country {
default no;
DE yes;
BE yes;
.....
}
Then, in the server directive of your website's config file, add:
# COUNTRIES BANLIST:
if ($allowed_country = no) {
return 403;
}
test to check that your config files are valid.
reload the service