1、准备工具
Centos6
Python
Shadowsocks服务端账号密码
2、安装Shadowsocks
yum install python-pip pip install shadowsocks vim /etc/shadowsocks-client.json # 添加以下内容 { "server":"shadowsocks服务端ip", "server_port":shadowsocks服务端端口, "local_address": "127.0.0.1", "local_port":1080, "password":"shadowsocks服务端密码", "timeout":300, "method":"aes-256-cfb", # 对应的加密方式 "fast_open": false, "workers": 1 }
3、启动Shadowsocks客户端(可写脚本添加到开启自启动项目)
nohup sslocal -c /etc/shadowsocks-client.json /dev/null 2>&1 &
4、检查全局模式是否启动成功
curl --socks5 127.0.0.1:1080 # 若origin为服务器ip则表示成功,为本机ip则表示失败 { "origin": "shadowsocks服务器ip" }
5、使用privoxy把流量转发到http、https服务上
shadowsocks是一个socket5服务,不能直接用在http上,所以需要使用privoxy代理转发到http流量上。
yum -y install privoxy vi /etc/privoxy/config listen-address 127.0.0.1:8118 # 确保有这一行即可 service privoxy start chkconfig privoxy on # 开机自启动
6、配置privoxy环境变量
vi /etc/profile # 添加如下变量 export http_proxy=http://127.0.0.1:8118 #这里的端口和上面 privoxy 中的保持一致 export https_proxy=# 使配置生效 source /etc/profile
7、配置gfwlist翻墙域名列表
# 获取 gfwlist2privoxy 脚本 curl -4sSkLO # 执行脚本生成gfwlist.action文件 bash gfwlist2privoxy '127.0.0.1:1080' # 移动文件到privoxy目录 mv -f gfwlist.action /etc/privoxy # 指定列表配置 echo 'actionsfile gfwlist.action' >>/etc/privoxy/config # 重启代理 service privoxy restart
8、校验结果
curl -4sSkL # 正常显示本机ip curl -I # 正常返回200
参考:
https://i4t.com/2778.html
https://www.zfl9.com/ss-local.html
来自ansion博客
2019-09-11 16:14:06