cloudflare
自带的节点速度很慢,于是自行反代它,然后自选ip到自建的节点
1、安装sniporxy
apt install sniproxy -y
2、更改配置文件/etc/sniproxy.conf
1)在其中添加监听https
(如果没有)
listen 443 {
proto tls
table https_hosts
access_log {
filename /var/log/sniproxy/https_access.log
priority notice
}
}
2)在table http_hosts
下添加代理
# kuku.me 即为自己的域名,1.1.1.1为cloudflare的ip
(.*.|)kuku.me$ 1.1.1.1
最终table http_hosts
如下
table http_hosts {
(.*.|)kuku.me$ 1.1.1.1
}
3)在table https_hosts
下添加代理
配置与http
类似,只是需要在代理的ip
后添加:443
table https_hosts {
(.*.|)kuku.me$ 1.1.1.1:443
}
4)最终的配置文件如下:
# sniproxy example configuration file
# lines that start with # are comments
# lines with only white space are ignored
user daemon
# PID file
pidfile /var/run/sniproxy.pid
error_log {
# Log to the daemon syslog facility
syslog daemon
# Alternatively we could log to file
#filename /var/log/sniproxy/sniproxy.log
# Control the verbosity of the log
priority notice
}
# blocks are delimited with {...}
listen 80 {
proto http
table http_hosts
# Fallback backend server to use if we can not parse the client request
access_log {
filename /var/log/sniproxy/http_access.log
priority notice
}
}
listen 443 {
proto tls
table https_hosts
access_log {
filename /var/log/sniproxy/https_access.log
priority notice
}
}
# named tables are defined with the table directive
table http_hosts {
(.*.|)kuku.me$ 1.1.1.1
# pattern:
# valid Perl-compatible Regular Expression that matches the
# hostname
#
# target:
# - a DNS name
# - an IP address (with optional port)
# - '*' to use the hostname that the client requested
#
# pattern target
#.*\.itunes\.apple\.com$ *:443
#.* 127.0.0.1:4443
}
# named tables are defined with the table directive
table https_hosts {
# When proxying to local sockets you should use different tables since the
# local socket server most likely will not autodetect which protocol is
# being used
#example.org unix:/var/run/server.sock
(.*.|)kuku.me$ 1.1.1.1:443
}
# if no table specified the default 'default' table is defined
table {
# if no port is specified default HTTP (80) and HTTPS (443) ports are
# assumed based on the protocol of the listen block using this table
}
3、启动
sniproxy
即可启动