Created
September 29, 2022 00:44
-
-
Save gelinger777/6a87d5ab918fdfc558fdc9b963cfceb5 to your computer and use it in GitHub Desktop.
Nginx Allow only Cloudflare IPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create /etc/nginx/cloudflare.conf with following content | |
``` | |
allow 173.245.48.0/20 ; | |
allow 103.21.244.0/22 ; | |
allow 103.22.200.0/22 ; | |
allow 103.31.4.0/22 ; | |
allow 141.101.64.0/18 ; | |
allow 108.162.192.0/18 ; | |
allow 190.93.240.0/20 ; | |
allow 188.114.96.0/20 ; | |
allow 197.234.240.0/22 ; | |
allow 198.41.128.0/17 ; | |
allow 162.158.0.0/15 ; | |
allow 104.16.0.0/13 ; | |
allow 104.24.0.0/14 ; | |
allow 172.64.0.0/13 ; | |
allow 131.0.72.0/22 ; | |
allow 2400:cb00::/32; | |
allow 2606:4700::/32; | |
allow 2803:f800::/32; | |
allow 2405:b500::/32; | |
allow 2405:8100::/32; | |
allow 2a06:98c0::/29; | |
allow 2c0f:f248::/32; | |
``` | |
then in vhost of the domain add | |
``` | |
include /etc/nginx/cloudflare-allow.conf; | |
deny all; | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment