3proxy+tinydns 設置代理服務

1 準備一臺linux 服務器,公網訪問;python3 環境,python2 也ok(沒人用python2了)
2 安裝3proxy yum install 3proxy 如果yum 查看沒有,需要安裝yum 源:yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
3 配置 /etc/3proxy.cfg 文件
cp 3proxy.cfg 3proxy.cfg-ar
rm -rf 3proxy.cfg
vim 3proxy.cfg
文件內容如下:
nserver 80.240.25.96
#DNS緩存
#nscache 65535
timeouts 1 5 30 60 180 1800 15 60
daemon
#users ox:CL:ox
#log /data/log/3proxy/3proxy.log D
log /var/log/3proxy/3proxy.log
logformat “- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T”
rotate 30
external 0.0.0.0
internal 0.0.0.0
auth iponly
maxconn 1000
allow *
#parent 1000 http 94.191.114.51 3130
#bandlimin 50000000 * * * 3130
proxy -n -p3130
flush

運行 service 3proxy start

安裝tinydns 服務
pip install tinydns
vim /etc/tinydns.conf

填寫配置文件
[tinydns]
m.so.com=171.8.167.12,180.163.239.219,42.236.98.98,180.163.251.63,104.192.110.225,101.198.191.56,221.181.72.215
www.so.com=171.8.167.22,180.163.239.218,171.8.167.31,180.163.251.85,42.236.9.70,27.115.124.192,104.192.110.226,117.135.153.183,117.135.153.171,101.198.191.55,111.7.73.11
運行命令:
tinydns -c /etc/tinydns.conf
這樣dns 服務代理,就實現了
測試
proxies = {“https”: “http://80.240.25.96:3130”, “http”: “http://80.240.25.96:3130”}
res = requests.get(“https://www.so.com”,proxies=proxies)
就會隨機解析到不同的IP,提高我們爬蟲效率

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章