sock5实现单一代理入口,通过多IP随机出访,适用于各种爬虫、反防刷,节前最后一篇文章,废话少说,走起!!!
软件下载
cd /usr/local/src wget "http://3proxy.ru/0.7.1.1/3proxy-0.7.1.1.tgz" wget "http://nginx.org/download/nginx-1.4.4.tar.gz" wget "https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip"
3proxy安装
tar xzf 3proxy-0.7.1.1.tgz cd 3proxy make -f Makefile.Linux make -f Makefile.Linux install
socks配置
socks -l/data/log/3proxy/socks.log -i0.0.0.0 -e10.10.32.192 -p9091 & ##10.10.32.x换成公网IP socks -l/data/log/3proxy/socks.log -i0.0.0.0 -e10.10.32.192 -p9092 & socks -l/data/log/3proxy/socks.log -i0.0.0.0 -e10.10.32.193 -p9093 &
nginx安装
yum install pcre-devel openssl-devel ##安装依赖 cd /usr/local/src tar xzf nginx-1.4.4.tar.gz unzip master.zip cd nginx-1.4.4 patch -p1 < /usr/local/src/nginx_tcp_proxy_module-master/tcp.patch ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --add-module=/usr/local/src/nginx_tcp_proxy_module-master make && make install
nginx配置
cat /usr/local/nginx/conf/nginx.conf user nobody nobody; # 出于安全,无特别要求禁止使用root worker_processes 2; # 推荐配置为CPU核数 error_log /data/log/nginx/error.log error; pid /var/run/nginx.pid; # 此路径不建议更改 events { use epoll; worker_connections 81920; } tcp { access_log /data/log/nginx/access.log; allow 10.0.0.0/8; allow 192.168.0.0/16; allow 172.28.0.0/16; allow 114.112.67.0/24; deny all; upstream cluster { server 127.0.0.1:9001; server 127.0.0.1:9002; server 127.0.0.1:9003; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8080; proxy_pass cluster; } }
nginx启动
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf &
使用方法:
curl --socks5 10.10.10.100:8080 http://www.cmcm.com
时间: 2024-10-03 17:39:40