• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Cloudflare: blocking country with nginx

omexlu

Regular Pleskian
Hello,

I found this on the internet:
Using CloudFlare for country blocking - Nginx Library

and wondering if this can be put in the additional nginx directive on GUI that way?:
Code:
map $http_cf_ipcountry $allow {
        default yes;
        CN no;
        MX no;
        NO no;
}
if ($allow = no) {
    return 403;
}

EDIT: I have tested it in directive on GUI:
Ungültige nginx-Konfiguration: nginx: [emerg] "map" directive is not allowed here

so it don't work there where can i put them (update safe)? :) maybe /etc/nginx/conf.d/ ?

EDIT2: I think that this part can be placed (update-safe) under /etc/nginx/conf.d/:
Code:
map $http_cf_ipcountry $allow {
        default yes;
        CN no;
        MX no;
        NO no;
}

And this in additional nginx directive in GUI:
Code:
if ($allow = no) {
    return 403;
}

Right?

Thanks in advance.
 
Last edited:
Hello,

I found this on the internet:
Using CloudFlare for country blocking - Nginx Library

and wondering if this can be put in the additional nginx directive on GUI that way?:
Code:
map $http_cf_ipcountry $allow {
        default yes;
        CN no;
        MX no;
        NO no;
}
if ($allow = no) {
    return 403;
}

EDIT: I have tested it in directive on GUI:
Ungültige nginx-Konfiguration: nginx: [emerg] "map" directive is not allowed here

so it don't work there where can i put them (update safe)? :) maybe /etc/nginx/conf.d/ ?

EDIT2: I think that this part can be placed (update-safe) under /etc/nginx/conf.d/:
Code:
map $http_cf_ipcountry $allow {
        default yes;
        CN no;
        MX no;
        NO no;
}

And this in additional nginx directive in GUI:
Code:
if ($allow = no) {
    return 403;
}

Right?

Thanks in advance.


this work ?
 
Somebody know if i can do that that way.

/etc/nginx/conf.d/* :
Code:
map $http_cf_ipcountry $allow {
        default yes;
        CN no;
        MX no;
        NO no;
}

And this in additional nginx directive in GUI:
Code:
if ($allow = no) {
    return 403;
}
 
Because nobody replys on that i ask again @UFHH01 do you know if i can put that map in /etc/nginx/conf.d/ and the other part on additional nginx directive in GUI?

Because i really need that :)
 
Hi omexlu,

at this forum you will meet users with knowledge about Plesk, who might have additional knowledge here and there, but if you desire UNIQUE support, for UNIQUE cloudflare settings and/or UNIQUE nginx settings, pls. consider to ask such questions at communities, who are specialized in cloudflare knowledge and/or nginx knowledge. ;)
 
Back
Top