1.注册aws 账号,启动ec2示例
账号注册注意点:
##11.邮箱必须是gmail,
##1.2开启指定端口的安全组
2.科学上网原理图
stunnel 主要是用来对数据的加密解密,这样https才可以正常访问
3.stunnel-client 安装
安装地址
window:下载完整之后启动stunnel(安装的时候会填一系列的参数,随便填即可) ,在配置文件后面添加
window 查看端口是否开启的方法:netstat -an |find "3130"
[https]
accept = 3130 (在本机开启一个3130的代理)
connect = xx.xx.xx.xx:3129 (连接stunnel-server的ip + 端口号)
cert = C:\Users\xxx\Documents\stunnel.pem (该pem为stunnel-server 一致)
client = yes
启动成功图:
3.stunnel-server 搭建squid 和 stunnel
3.1 squid 搭建
在stunnel-server 服务器上yum install -y squid
vim /etc/squid/squid.conf
修改
vim /etc/squid/squid.conf
# http_access deny all
http_access allow all
启动squid:systemctl start squid
查看squid端口是否启动3128端口:netstat -ntpl |grep squid
3.2 stunnel-server 搭建
yum install -y stunnel
3.2.1 生成证书
openssl req -new -x509 -days 3650 -nodes -out stunnel.pem -keyout stunnel.pem
openssl gendh 512>> stunnel.pem #不是必须的
ps: 这格时候就有一个stunnel.pem 的文件,里面有私钥和证书,(对应的是上面stunnel-client pem)
3.2.2 修改stunnel配置
vim /etc/stunnel/stunnel.conf
添加如下内容:
cert = /root/stunnel.pem
CAfile = /root/stunnel.pem
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;;;chroot = /var/run/stunnel
pid = /tmp/stunnel.pid
verify = 3
;;; CApath = certs
;;; CRLpath = crls
;;; CRLfile = crls.pem
;setuid = stunnel
;setgid = stunnel
;;; client=yes
compression = zlib
;;; taskbar = no
delay = no
;;; failover = rr
;;; failover = prio
sslVersion = TLSv1
fips=no
debug = 7
syslog = no
output = stunnel.log
[sproxy]
accept = 3129(和stunnel-client connect的端口要对应上)
connect = 127.0.0.1:3128(连接squid)
启动stunnel:stunnel
ps:如果没有信息则配置成功
查看是否成功:ps aux | grep stunnel
4.设置代理
建议拿chrome 扩展 SwitchyOmega 来代理
代理ip: 127.0.0.1:3130
到此window 科学上网成功。
参考1
参考 2
参考3
参考window mac linux