生成socks代理以及http代理

1.如何生成socks5代理
首先得有一台云服务器,然后执行
#nohup ssh -i /sshlogin/.pem 52... -v -f -N -D 0.0.0.0:7070
#export http_proxy=socks5://127.0.0.1:7070
#export https_proxy=socks5://127.0.0.1:7070
本地shell即可上网。
2.有些网站并不支持socks代理,如jenkins插件安装,只能用http代理,这时就需要将本地socks代理转为http代理
方法:利用privoxy工具
步骤:
步骤一 安装privoxy
yum -y install privoxy
步骤二 修改配置文件

配置文件位置:/etc/privoxy/config
listen-address 127.0.0.1:8118 替换为listen-address 0.0.0.0:8118
#permit-access 127.0.0.1 替换为permit-access 0.0.0.0
#forward-socks5t / 127.0.0.1:1080 . 替换为forward-socks5t / 127.0.0.1:7070 .
注意:网上好多把forward-socks5t写成forward-socks5,,会出问题。

步骤三 启动服务
systemctl start privoxy

如需开机启动,则执行

systemctl enable privoxy
步骤四 设置Shell走HTTP代理

HTTP代理

export http_proxy=http://IP地址:端口

HTTPS代理

export http_proxy=http://IP地址:端口

FTP代理

export ftp_proxy=http://IP地址:端口
参考:https://gongdear.com/articles/2018/11/12/1542000109176.html

猜你喜欢

转载自blog.csdn.net/lyf0327/article/details/89884340
今日推荐