Linux中使用ShadowSocks+Privoxy代理

安装shadowsocks客户端

1
2
yum install python-pip
pip install shadowsocks -i https://pypi.tuna.tsinghua.edu.cn/simple requests

运行shadowsocks(一条命令)

1
nohup sslocal -s 1.1.1.1 -p 8008 -l 1080 -k abc123 -t 600 -m aes-256-cfb > /root/ss.log 2>&1 &

运行shadowsocks(读取配置文件)

1
2
3
4
5
6
7
8
9
10
11
12
13
nohup sslocal -c /etc/shadowsocks.json >>/root/ss.log 2>&1 &

{
"server":"1.1.1.1",
"server_port":8008,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"abc123",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"workers": 1
}

安装privoxy

1
yum install privoxy -y

配置

grep -v “#” /etc/privoxy/config |grep -v “^$”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
confdir /etc/privoxy
logdir /var/log/privoxy
filterfile default.filter
logfile logfile
listen-address 127.0.0.1:8118
toggle 1
enable-remote-toggle 0
enable-remote-http-toggle 0
enable-edit-actions 0
enforce-blocks 0
buffer-limit 4096
enable-proxy-authentication-forwarding 0
forward-socks5t / 127.0.0.1:1080 .
forwarded-connect-retries 0
accept-intercepted-requests 0
allow-cgi-request-crunching 0
split-large-forms 0
keep-alive-timeout 5
tolerate-pipelining 1
socket-timeout 300

启动

1
2
systemctl restart privoxy 
systemctl enable privoxy

转发配置

1
2
3
4
> vim /etc/profile
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
> source /etc/profile

仅在当前 session 生效

1
2
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118

https://www.jianshu.com/p/48b3866b5e2a