linux翻牆操作:
https://www.aliyun.com/jiaocheng/121212.html
1、privoxy安裝
安裝很簡單用brew安裝
brew install privoxy
2、privoxy配置
打開配置文件 /usr/local/etc/privoxy/config
vim /usr/local/etc/privoxy/config
加入下面這兩項配置項
listen-address 0.0.0.0:8118
forward-socks5 / localhost:1080 .
第一行設置privoxy監聽任意IP地址的8118端口。第二行設置本地socks5代理客戶端端口,注意不要忘了最後有一個空格和點號。
3、啓動privoxy
因爲沒有安裝在系統目錄內,所以啓動的時候需要打全路徑。
sudo /usr/local/sbin/privoxy /usr/local/etc/privoxy/config
4、查看是否啓動成功
netstat -na | grep 8118
看到有類似如下信息就表示啓動成功了
tcp4 0 0 *.8118 *.* LISTEN
5、privoxy使用
在命令行終端中輸入如下命令後,該終端即可翻牆了。
export http_proxy='http://localhost:8118'
export https_proxy='http://localhost:8118'
他的原理是講socks5代理轉化成http代理給命令行終端使用。
如果不想用了取消即可
unset http_proxy
unset https_proxy
如果關閉終端窗口,功能就會失效,如果需要代理一直生效,則可以把上述兩行代碼添加到 ~/.bash_profile 文件最後。
vim ~/.bash_profile
-----------------------------------------------------
export http_proxy='http://localhost:8118'
export https_proxy='http://localhost:8118'
-----------------------------------------------------
使配置立即生效
source ~/.bash_profile
6、查看是否成功
重新打開命令行
curl ip.gs
查看現在的ip