• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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