Centos7 下traojan配置privoxy
下载trojan
首先去github下载 linux版本 https://github.com/trojan-gfw/trojan/releases/tag/v1.16.0
wget https://github.com/trojan-gfw/trojan/releases/download/v1.16.0/trojan-1.16.0-linux-amd64.tar.xz
tar xvf trojan-1.16.0-linux-amd64.tar.xz
将配置写在config.json下
cd trojan
// 写入配置
vi config.json
// 后台运行trojan
nohup ./trojan &
下载与配置privoxy
安装
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/privoxy-3.0.26-1.el7.x86_64.rpm
rpm -Uvh privoxy-3.0.26-1.el7.x86_64.rpm
配置
vi /etc/privoxy/config
写入以下内容
listen-address 127.0.0.1:1081
toggle 0
show-on-task-bar 0
activity-animation 0
forward-socks5 / 127.0.0.1:1080 .
hide-console
启动服务
先关闭selinux, 不然可能没法启用privoxy
//1. 临时关闭
setenforce 0
// 2. 永久关闭 (需要reboot才能生效)
vi /etc/selinux/config
// 找到对应行,设置disabled
SELINUX=disabled
// 重新启动, 若设置永久关闭需要重新启动trojan
reboot
启动代理
systemctl start privoxy.service
设置全局代理
export http_proxy=http://localhost:1081/
export https_proxy=http://localhost:1081/
ping
[root@localhost Downloads]# ping google.com
PING google.com (172.217.25.14) 56(84) bytes of data.
64 bytes from hkg07s24-in-f14.1e100.net (172.217.25.14): icmp_seq=1 ttl=116 time=23.2 ms
64 bytes from hkg07s24-in-f14.1e100.net (172.217.25.14): icmp_seq=2 ttl=116 time=23.6 ms
64 bytes from hkg07s24-in-f14.1e100.net (172.217.25.14): icmp_seq=3 ttl=116 time=23.6 ms
64 bytes from hkg07s24-in-f14.1e100.net (172.217.25.14): icmp_seq=4 ttl=116 time=23.9 ms
64 bytes from hkg07s24-in-f14.1e100.net (172.217.25.14): icmp_seq=5 ttl=116 time=23.3 ms