Learn about Centmin Mod LEMP Stack today
Become a Member

Cloudflare How to config Nginx block all request not from Cloudflare ?

Discussion in 'Domains, DNS, Email & SSL Certificates' started by manhdv, Oct 10, 2020.

  1. manhdv

    manhdv New Member

    3
    0
    1
    Jun 1, 2019
    Ratings:
    +1
    Local Time:
    6:43 PM
    How to config Nginx block all request not from Cloudflare ?
    Thanks.

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,911
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    9:43 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    2 ways

    1. via CSF Firewall but can block other software that requires updates so you need to know which software/IPs to whitelist

    2. via Cloudflare Authenticated Origin Pull certificate setup as outlined at Cloudflare - Setting Up Cloudflare Authenticated Origin Pulls Protecting Your Origins which is easier way with less mistakes. If using most recent 123.09beta01 or newer, Centmin Mod already has setup Cloudflare Authenticated Origin Pull certificate for each Nginx vhost in disabled state which can you enable see 3rd post here