Skip to content

ChinaSiro/CloudFlare-RealiP-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

作者

https://huo0.com

CloudFlare-RealiP-nginx

站点经过CloudFlare(后称CF)代理后,用户访问到NGINX后的IP都会变成CDN的IP。 阻碍了IP限制约束,站点/VPS比较多,为了避免重复操作 把主conf中遵循*.conf规则利用,写了realip.conf 通过命令写入到指定路径,并重载nginx配置

命令

宝塔云/Debian&Centos

CF_URL='https://raw.githubusercontent.com/ChinaSiro/CloudFlare-RealiP-nginx/main/realip.conf'; TARGET='/www/server/panel/vhost/nginx/realip.conf'; sudo mkdir -p "$(dirname "$TARGET")" && sudo curl -fsSL "$CF_URL" -o "$TARGET" && sudo nginx -t && sudo /www/server/nginx/sbin/nginx -s reload

自定义

{url.conf} 远程下载地址.conf {local.conf} 本地存放路径.conf

CF_URL='{url.conf}'; TARGET='{local.conf}'; sudo mkdir -p "$(dirname "$TARGET")" && sudo curl -fsSL "$CF_URL" -o "$TARGET" && sudo nginx -t && sudo /www/server/nginx/sbin/nginx -s reload

来源IP信任名单

https://www.cloudflare.com/ips-v4 https://www.cloudflare.com/ips-v6

About

让nginx经过CloudFlare代理后获取用户真实IP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors