------ ОБНОВЛЕНО 04 марта 2017 г. -------
Я был там и обнаружил, что лучшее решение было:
Если у вас нет выделенного сервера или хотя бы vps и немного терпения, не беспокойтесь о прочтении оставшейся части поста ...
1 -Установите Squid 3.2 из исходного кода (см. Примечания ниже)
2 - добавьте список из примерно 20 ip-ов в squid.conf (стоит около 25 $ в месяц)
3 - используйте новую функцию ACLrandom повернуть исходящий ip.
Таким образом, вам не нужно поворачивать список ip в вашем php-скрипте, вместо этого вы будете подключаться к тому же ip (например: 192.168.1.1:3129), но видимыйИсходящий ip (tcp_outgoing_address
) будет вращаться при каждом запросе на основе случайных настроек.
Вам необходимо скомпилировать squid 3.2 с '-enable-http-violations'
, чтобы сделать его элитным анонимным прокси.
Пошаговая установка:
yum -y groupinstall 'Development Tools'
yum -y install openssl-devel
wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.13.tar.gz
tar -xvf squid-3.2.13.tar.gz
cd squid-3.2.13
./configure -prefix=/squid32 '--enable-removal-policies=heap,lru' '--enable-ssl' '--with-openssl' '--enable-linux-netfilter' '--with-pthreads' '--enable-ntlm-auth-helpers=SMB,fakeauth' '--enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group' '--enable-auth-basic' '--enable-auth-digest' '--enable-auth-negotiate' '--enable-auth-ntlm' '--with-winbind-auth-challenge' '--enable-useragent-log' '--enable-referer-log' '--disable-dependency-tracking' '--enable-cachemgr-hostname=localhost' '--enable-underscores' '--enable-build-info' '--enable-cache-digests' '--enable-ident-lookups' '--enable-follow-x-forwarded-for' '--enable-wccpv2' '--enable-fd-config' '--with-maxfd=16384' '-enable-http-violations'
make
make install
Пример squid.conf (в данном случае находится /squid32/etc/squid.conf):
#this will be the ip and port where squid will run
http_port 5.5.5.5:33333 # change this ip and port ...
#Extra parameters on squid.conf to make an elite proxy
request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all
via off
forwarded_for off
follow_x_forwarded_for deny all
acl vinte1 random 1/5
acl vinte2 random 1/5
acl vinte3 random 1/5
acl vinte4 random 1/5
acl vinte5 random 1/5
tcp_outgoing_address 1.1.1.1 vinte1 # fake ip's , replace with yours
tcp_outgoing_address 1.1.1.2 vinte2
tcp_outgoing_address 1.1.1.3 vinte3
tcp_outgoing_address 1.1.1.4 vinte4
tcp_outgoing_address 1.1.1.5 vinte5
tcp_outgoing_address 1.1.1.6 # this will be the default tcp outgoing address
Пример запроса PHP CURL с использованием прокси-сервера squid:
$proxy = "1.1.1.1:33333";
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
$url = "https://api.ipify.org/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
curl_setopt($ch, CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1' );
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD,'USER:PASS');
curl_setopt($ch, CURLOPT_USERAGENT,$useragent);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result
Полезные ссылки:
Squid3.2 Источник : http://www.squid -cache.org / Versions / v3 / 3.2 / squid-3.2.13.tar.gz
Rotating_three_IPs : http://wiki.squid -cache.org / ConfigExamples / Strange / RotatingIPs # Пример: _Rotating_three_IPs_based_on_time_of_day
AclRandom : http://wiki.squid -cache.org / Features / AclRandom
Установка Squid 3.2 в CentOS 5.3 - http://www.guldmyr.com/blog/installing-squid-3-2-on-centos-5-3/
Добавить пароль в Squid : Как настроить прокси-сервер squid с базовой аутентификацией по имени пользователя и паролю?
Я считаю, что это самый надежный и безопасный способ чередования прокси, поскольку вы не полагаетесь на сторонних прокси-провайдеров и ваша информация (пароли, данные и т. Д.) Будет более безопасной.Поначалу это может показаться немного сложным, но окупится за каждую потраченную секунду, GL :)