docker 容器版本需要手动构建一个镜像
docker run -itd --name ubuntu_test ubuntu bash
# 在容器里面执行的命令
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
apt update
apt install systemd init -y
exit
# 在容器外面执行【构建镜像】
docker export ubuntu_test > ubuntu.tar
docker import ubuntu.tar ml_ubuntu:latest
docker rm ubuntu_test
docker 容器版本需要执行下面语句
docker run -itd --name ml -p 8089:80 -p 1194:1194 --privileged -v /opt/debian_ml:/data --device /dev/net/tun:/dev/net/tun --cap-add=NET_ADMIN ml_ubuntu /usr/sbin/init
安装基础代理工具
apt install squid nano -y
mv /etc/squid/squid.conf /etc/squid/squid.conf.bak
编辑http代理信息
nano /etc/squid/squid.conf
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
#http_access allow localhost manager
#http_access deny manager
include /etc/squid/conf.d/*.conf
#http_access allow localhost
#http_access deny all
#http_port 3128
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
refresh_pattern \/Release(|\.gpg)$ 0 0% 0 refresh-ims
refresh_pattern \/InRelease$ 0 0% 0 refresh-ims
refresh_pattern \/(Translation-.*)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
refresh_pattern . 0 20% 4320
http_access allow all
http_port 80
acl Safe_ports port 1194 # openvpn
安装openvpn
wget https://d.frps.cn/file/openvpn/openvpn-install.sh && bash openvpn-install.sh
修改生成得openvpn配置文件(比如:client.ovpn)
client
dev tun
proto tcp
# 可以修改为127.0.0.1等,就是不能修改为公网的,相当于通过http代理后连接的地址
remote 172.17.0.6 1194
#remote 192.168.88.5 1194
# 添加这一行,ip填写公网得ip,端口填写映射的http代理端口
http-proxy 192.168.88.5 8089
#http-proxy 127.0.0.1 9021
#http-proxy-option EXT1 "GET http://mopan.sc.189.cn"
# 添加协议头,达到某种效果
http-proxy-option EXT1 "Host: mopan.sc.189.cn"
http-proxy-option EXT1 "host: mopan.sc.189.cn"
http-proxy-option EXT1 "X-Online-Host: mopan.sc.189.cn"
#http-proxy-retry
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
auth SHA512
cipher AES-256-CBC
ignore-unknown-option block-outside-dns
verb 3
手动启动openvpn服务
openvpn --config /etc/openvpn/server/server.conf
上面操作完以后,可能能连接,但是无法上网,需要运行下面语句允许访问外网
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE