Ubuntu18.04使用privoxy将socks转为https、http和ftp代理

privoxy可以转换socks代理
1.将socks代理地址设置为127.0.0.1:1080
2.安装privoxy

$ sudo apt install privoxy

3.更改provoxy配置

$ sudo vi /etc/privoxy/config

froward-socks4下面添加一条socks5的,地址是127.0.0.1:1080。注意最后有一个.

forward-socks5   /  127.0.0.1:1080 .

下面还存在以下一条配置,表示privoxy监听本机8118端口
把它作为http代理,代理地址为http://localhost:8118/
可以把地址改为 0.0.0.0:8118,表示外网也可以通过本机IP作http代理

listen-address 127.0.0.1:8118

4.重启privoxy

$ sudo systemctl restart privoxy.serivce

5.现在你就可以使用http代理了

如果你要给系统设置http代理,就在~/.bashrc里添加一条http_proxy配置

$ vi ~/.bashrc

添加:

export https_proxy=http://127.0.0.1:8118
export http_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118

然后source使它立刻生效

$ source ~/.bashrc

如果你只需要在当前打开的终端下生效,终端下输入:

export https_proxy=http://127.0.0.1:8118
export http_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118

即可。

参考资料1
参考资料2

猜你喜欢

转载自blog.csdn.net/gongchenyu/article/details/80482981