Join the community 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:
    12:53 PM
    How to config Nginx block all request not from Cloudflare ?
    Thanks.
     
  2. eva2000

    eva2000 Administrator Staff Member

    45,420
    10,304
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,983
    Local Time:
    3:53 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    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