12-03-2016, 06:47 PM #1
How to block traffic from selected country
How to block traffic from selected country?
12-03-2016, 06:56 PM #2
You can block traffic from selected country by block IP addresses (or IP ranges) from that country.
Read more on this guide
Hope that helps!
12-03-2016, 07:04 PM #3
I think, this is very helpful, especially
Thank you Alex
12-14-2016, 10:13 AM #4
To block traffic from specific country, you can apply filter on geopgraphy.
For example you want to block russian traffic from Google analytics, follow the below stepes:
Filter Type: Custom filter > Include
Filter Field: Country
Filter Pattern: Russia
06-30-2017, 12:05 PM #5
First of install the csf on the serer after that Click on the Firewall Configuration button to open the configuration file and page, scroll down to the Country Code Lists and Settings section.
## Use the CC_DENY field to block by country code:
The CC_DENY field accepts two-letter country codes.
such as “US” for the United States of America, “GB” for Great Britain, and “DE” for Germany.
IN this way the specific country code traffic has deny to server.
09-26-2017, 11:56 PM #6
You can do this with Cloudflare or a .htaccess rule.
10-23-2017, 11:00 AM #7
I realize I'm late on this, but you'll want to block the IP addresses (or ranges) as far up the "chain" as possible.
In other words, if you're blocking them with .htaccess or similar level, that means the traffic has already "hit" your site.
If you block at the iptables level, then you're saving website processing (Apache, Nginx...) for your website.
Let me know if you have further questions about this.
10-23-2017, 11:34 AM #8
This will actually depends on the internet provider you are using. VPN is now a trend. If you tend to use VPN and want to block countries for your site, I'd prefer not to do it. Because once you logged into another device, your settings will be refreshed. Better have a suitable internet provider first. Then follow the steps the others have given. Ciao
08-30-2018, 11:09 AM #9
You may try the CSF which has ability to filter out access by country codes.
10-08-2019, 09:21 AM #10
1. Adding rules in htaccess
You can use the link: https://www.ip2location.com/free/visitor-blocker to generate the range of IP's which needs to be blocked
2. Using Cloudflare CDN
You can find the instructions to so here: https://support.cloudflare.com/hc/en-us/articles/217074967-Configuring-IP-Access-Rules
3. Using CSF
In the csf configuration file (/etc/csf/csf.conf), there is an option to block/allow access from an IP range by using country code. Here I’m going to explain how to allow or deny IP range using this feature.
For allowing a country to your server you can use the directive ‘CC_ALLOW‘ from the csf configuration file
CC_ALLOW = ""
Similarly, you can deny by using the directive ‘CC_DENY‘
CC_DENY = ""
Each option is a comma separated list of CC’s, e.g. “US,GB,DE”
You need to restart the csf service to get the changes to be worked. Run the following command for restarting the csf service.
AF,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH ,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BA,BW,BV,BR,IO,BN,BG,B F,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,
CG,CD,CK,CR,CI,HR,CU,CY,CZ,DK,DJ,DM,DO,TP,EC,EG,SV ,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,FX,GF,PF,TF,GA,GM,GE,D E,GH,GI,GR,GL,GD,GP,GU,GT,GN,GW,GY,HT,HM,VA,
HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KI ,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,M W,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,
MS,MA,MZ,MM,NA,NR,NP,NL,AN,NC,NZ,NI,NE,NG,NU,NF,MP ,NO,OM,PK,PW,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,R U,RW,KN,LC,VC,WS,SM,ST,SA,SN,SC,SL,SG,SK,SI,
SB,SO,ZA,GS,ES,LK,SH,PM,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ ,TZ,TH,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,U M,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW
10-09-2019, 01:15 PM #11
Replies: 15 | Views: 2922Last post by daniel27lt, 07-17-2017, 01:54 PM
Replies: 13 | Views: 4871Last post by Sirarpi3, 05-24-2018, 02:02 PM
Replies: 18 | Views: 3725Last post by CookieRunner, 10-24-2017, 11:21 AM
Replies: 6 | Views: 1711Last post by YacaZG, 12-06-2016, 06:35 AM
Replies: 3 | Views: 1512Last post by Ron Killian, 01-28-2017, 04:34 AM
Replies: 23 | Views: 3844Last post by paritosh, 11-15-2018, 03:58 PM
Replies: 4 | Views: 1510Last post by YacaZG, 12-09-2016, 06:40 AM
Replies: 4 | Views: 1275Last post by YacaZG, 12-03-2016, 06:21 PM
Replies: 9 | Views: 1549Last post by ngoctam699, 12-04-2016, 03:16 AM
Replies: 0 | Views: 30Last post by jowel, Yesterday, 01:09 PM
By HostXNow in forum Reseller Hosting OffersReplies: 0 | Views: 155Last post by HostXNow, 10-10-2019, 02:16 PM
By HostXNow in forum Shared Hosting OffersReplies: 0 | Views: 166Last post by HostXNow, 10-10-2019, 02:12 PM
By PaymentGateway in forum Search Engine OptimizationReplies: 3 | Views: 175Last post by PaymentGateway, 10-14-2019, 05:12 AM
By arindamb in forum Social Media MarketingReplies: 2 | Views: 275Last post by ORLOVA, Yesterday, 07:02 AM
Replies: 5 | Views: 1803Last post by cre8ivemedia, 03-14-2017, 02:54 PM
Replies: 2 | Views: 1412Last post by hostslim, 11-19-2015, 11:02 AM
By JoanHumphreys in forum Online Internet MarketingReplies: 1 | Views: 1762Last post by TheLifeStyleMentor, 06-18-2015, 11:48 AM
By success druggy in forum Search Engine OptimizationReplies: 10 | Views: 3202Last post by aliblogger, 12-24-2014, 06:58 PM
By vaneetagoswami in forum Web Development - Programming & CodingReplies: 1 | Views: 1808Last post by Dopani, 12-12-2014, 03:00 PM