Now the problem is, when cloudflare updated their IP range, you need to update this file too, to make sure your IP list in this configure file is updated with theirs. You can achieve this by running a crontab script:
CONF_FILE_PATH = "/etc/nginx/conf.d/cloudflare.conf" USER_AGENTS = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15", ]
This file will detect if there is a change, if there isn’t, it won’t do anything, otherwise, it will update the cloudflare.conf file content then issue a nginx restart. You can run this script every day as crontab under the user root (since you need the priviledge to run nginx -s reload to restart nginx after the file changes)