找一个能被反向和面板通讯的中间机器
首先在中间机器安装nginx
apt install nginx-full查看状态:
nginx -V 2>&1 | grep --color -o with-stream如果显示with-stream就可以直接配置
编辑 Nginx 的主配置文件
nano /etc/nginx/nginx.conf添加 Stream 配置: 请找到文件中的 http { ... } 块。在 http 块的外面(通常建议放到文件最底部,或者 http 块的上面),添加以下内容
# 【建议】暂时注释掉这一行,防止 web 网站抢占 443 端口
# include /etc/nginx/sites-enabled/*;stream {
# 使用阿里 DNS
resolver 223.5.5.5 ipv6=off;
server {
# 【关键】监听 5443,避开防火墙审查
listen 5443;
# 开启 SSL 预读
ssl_preread on;
# 转发给面板域名 (Cloudflare)
proxy_pass 这里改自己的域名:443;
}
}nginx -t
systemctl restart nginx检查并重启
去被反向的机器修改hosts
nano /etc/hosts中间机器ip 域名
在被通报的机器安装
apt-get install iptables -yiptables -t nat -A OUTPUT -p tcp -d 中间机器ip --dport 443 -j DNAT --to-destination 中间机器ip:5443修改完想删除就执行
iptables -t nat -D OUTPUT -p tcp -d 中间机器ip --dport 443 -j DNAT --to-destination 中间机器ip:5443关闭中间机器的nginx
systemctl stop nginx