centos7编译安装snproxy之后,/etc/sniproxy.conf配置如下:
user daemon pidfile /var/run/sniproxy.pid resolver { #指定 dns 服务器 nameserver 8.8.8.8 mode ipv4_only } listen 80 { proto http table http_hosts access_log { filename /var/log/sniproxy.log priority notice } } error_log { syslog daemon #filename /var/log/sniproxy.error.log priority notice } listen 0.0.0.0:443 { proto tls table https_hosts access_log { filename /var/log/sniproxy.log priority notice } } #对于 http 只转发以下指定的泛域名数据 table http_hosts { (.*\.|)cdnfly\.pw$ 104.18.3.161 } #对于 https 只转发以下指定的泛域名数据 table https_hosts { (.*\.|)cdnfly\.pw$ 104.18.3.161:443 }
运行命令:
sniproxy -c /etc/sniproxy.conf
将你的域名解析到sniproxy服务器IP即可
优点:性能最佳
缺点:cf无法获取用户真实IP