更新於 2022/08/07閱讀時間約 1 分鐘

使用Cloudflare時設定cloudflare的ip白名單在Nginx

    vi /etc/nginx/conf.d/default.conf
    # IPv4
    allow 103.21.244.0/22;
    allow 103.22.200.0/22;
    allow 103.31.4.0/22;
    allow 104.16.0.0/13;
    allow 104.24.0.0/14;
    allow 108.162.192.0/18;
    allow 131.0.72.0/22;
    allow 141.101.64.0/18;
    allow 162.158.0.0/15;
    allow 172.64.0.0/13;
    allow 173.245.48.0/20;
    allow 188.114.96.0/20;
    allow 190.93.240.0/20;
    allow 197.234.240.0/22;
    allow 98.41.128.0/17;
    # IPv6
    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;
    deny all;
    重新啟動 nginx
    分享至
    成為作者繼續創作的動力吧!
    © 2024 vocus All rights reserved.