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