@@ -388,4 +388,105 @@ sudo ln -s /etc/nginx/sites-available/not-copy /etc/nginx/sites-enabled/
|
|||||||
sudo nginx -t
|
sudo nginx -t
|
||||||
|
|
||||||
# Рестарт
|
# Рестарт
|
||||||
sudo systemctl reload nginx
|
sudo systemctl reload nginx
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
# ПОЛНАЯ ИНСТРУКЦИЯ: НАСТРОЙКА ПРОКСИ ДЛЯ ОБХОДА БЛОКИРОВОК SEARCHAPI.IO
|
||||||
|
|
||||||
|
## Данные для подключения к прокси-серверу
|
||||||
|
IP: 193.46.217.94
|
||||||
|
Порт HTTP: 3128
|
||||||
|
Порт SOCKS: 1080
|
||||||
|
Логин SSH: root
|
||||||
|
Пароль SSH: u7nRtsD6
|
||||||
|
|
||||||
|
## 1. Настройка прокси-сервера
|
||||||
|
```bash
|
||||||
|
# Подключаемся к серверу
|
||||||
|
ssh root@193.46.217.94
|
||||||
|
# Вводим пароль: u7nRtsD6
|
||||||
|
|
||||||
|
# Обновляем систему и устанавливаем пакеты
|
||||||
|
yum update -y
|
||||||
|
yum install -y epel-release net-tools nano
|
||||||
|
yum install -y 3proxy
|
||||||
|
|
||||||
|
# Создаем конфигурацию
|
||||||
|
mkdir -p /etc/3proxy
|
||||||
|
cat > /etc/3proxy/3proxy.cfg << 'EOF'
|
||||||
|
nserver 8.8.8.8
|
||||||
|
nserver 8.8.4.4
|
||||||
|
timeouts 1 5 30 60 180 1800 15 60
|
||||||
|
daemon
|
||||||
|
log /var/log/3proxy/3proxy.log
|
||||||
|
logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
|
||||||
|
rotate 30
|
||||||
|
auth none
|
||||||
|
allow * * * * *
|
||||||
|
proxy -p3128
|
||||||
|
socks -p1080
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Создаем папку для логов и запускаем прокси
|
||||||
|
mkdir -p /var/log/3proxy
|
||||||
|
/usr/bin/3proxy /etc/3proxy/3proxy.cfg
|
||||||
|
|
||||||
|
# Проверяем, что запустилось
|
||||||
|
ps aux | grep 3proxy
|
||||||
|
netstat -tulpn | grep -E '3128|1080'
|
||||||
|
|
||||||
|
# Настраиваем файрвол
|
||||||
|
firewall-cmd --permanent --add-port=3128/tcp
|
||||||
|
firewall-cmd --permanent --add-port=1080/tcp
|
||||||
|
firewall-cmd --reload
|
||||||
|
firewall-cmd --list-ports
|
||||||
|
|
||||||
|
# Проверяем локальную работу прокси
|
||||||
|
curl -x http://127.0.0.1:3128 https://api.ipify.org
|
||||||
|
# Должен вернуть: 193.46.217.94
|
||||||
|
|
||||||
|
# Настраиваем автозапуск
|
||||||
|
echo "/usr/bin/3proxy /etc/3proxy/3proxy.cfg" >> /etc/rc.local
|
||||||
|
chmod +x /etc/rc.local
|
||||||
|
|
||||||
|
|
||||||
|
# Проверяем доступность прокси
|
||||||
|
ping -c 4 193.46.217.94
|
||||||
|
curl -x http://193.46.217.94:3128 https://api.ipify.org
|
||||||
|
# Должен вернуть: 193.46.217.94
|
||||||
|
|
||||||
|
# Проверяем работу с SearchAPI через прокси
|
||||||
|
curl -x http://193.46.217.94:3128 "https://www.searchapi.io/api/v1/search?engine=google_lens&api_key=5jyYZC8jSaxhZTwjMUhwtAXi&url=https://dev-workspace.not-copy.com/api/files/public/76d06557-6df1-4fcd-a273-050ec6a35faf&search_type=exact_matches" -o test.json
|
||||||
|
ls -la test.json
|
||||||
|
tail -20 test.json
|
||||||
|
# Файл должен быть полным (заканчиваться на '}')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ps aux | grep 3proxy # Проверка статуса
|
||||||
|
netstat -tulpn | grep -E '3128|1080' # Проверка портов
|
||||||
|
tail -f /var/log/3proxy/3proxy.log # Просмотр логов
|
||||||
|
killall 3proxy # Остановка прокси
|
||||||
|
/usr/bin/3proxy /etc/3proxy/3proxy.cfg # Запуск прокси
|
||||||
|
|
||||||
|
|
||||||
|
firewall-cmd --permanent --remove-port=3128/tcp
|
||||||
|
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="IP_ТВОЕГО_СЕРВЕРА" port port="3128" protocol="tcp" accept'
|
||||||
|
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="IP_ТВОЕГО_СЕРВЕРА" port port="1080" protocol="tcp" accept'
|
||||||
|
firewall-cmd --reload
|
||||||
|
|
||||||
|
|
||||||
|
На прокси-сервере:
|
||||||
|
bash
|
||||||
|
ps aux | grep 3proxy # Проверка статуса
|
||||||
|
netstat -tulpn | grep -E '3128|1080' # Проверка портов
|
||||||
|
tail -f /var/log/3proxy/3proxy.log # Просмотр логов
|
||||||
|
killall 3proxy # Остановка прокси
|
||||||
|
/usr/bin/3proxy /etc/3proxy/3proxy.cfg # Запуск прокси
|
||||||
|
|
||||||
|
На основном сервере:
|
||||||
|
bash
|
||||||
|
curl -x http://193.46.217.94:3128 https://api.ipify.org # Проверка прокси
|
||||||
|
telnet 193.46.217.94 3128 # Проверка порта
|
||||||
@@ -59,8 +59,8 @@ public class SearchImageService {
|
|||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
.followSslRedirects(true)
|
.followSslRedirects(true)
|
||||||
.retryOnConnectionFailure(true)
|
.retryOnConnectionFailure(true)
|
||||||
.protocols(Arrays.asList(Protocol.HTTP_1_1))
|
// .protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||||
// .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
this.googleHttpClient = new OkHttpClient.Builder()
|
this.googleHttpClient = new OkHttpClient.Builder()
|
||||||
@@ -72,8 +72,8 @@ public class SearchImageService {
|
|||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
.followSslRedirects(true)
|
.followSslRedirects(true)
|
||||||
.retryOnConnectionFailure(true)
|
.retryOnConnectionFailure(true)
|
||||||
.protocols(Arrays.asList(Protocol.HTTP_1_1))
|
// .protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||||
// .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
this.objectMapper = new ObjectMapper();
|
this.objectMapper = new ObjectMapper();
|
||||||
@@ -148,20 +148,20 @@ public class SearchImageService {
|
|||||||
.addQueryParameter("t_", String.valueOf(System.currentTimeMillis()))
|
.addQueryParameter("t_", String.valueOf(System.currentTimeMillis()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Request request = new Request.Builder()
|
|
||||||
// .url(url)
|
|
||||||
// .header("Accept", "application/json")
|
|
||||||
// .header("User-Agent", "Mozilla/5.0")
|
|
||||||
// .build();
|
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
.header("Accept", "*/*")
|
.header("Accept", "application/json")
|
||||||
.header("User-Agent", "PostmanRuntime/7.29.2")
|
.header("User-Agent", "Mozilla/5.0")
|
||||||
.header("Accept-Encoding", "gzip, deflate")
|
|
||||||
.header("Connection", "keep-alive")
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Request request = new Request.Builder()
|
||||||
|
// .url(url)
|
||||||
|
// .header("Accept", "*/*")
|
||||||
|
// .header("User-Agent", "PostmanRuntime/7.29.2")
|
||||||
|
// .header("Accept-Encoding", "gzip, deflate")
|
||||||
|
// .header("Connection", "keep-alive")
|
||||||
|
// .build();
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
try (Response response = client.newCall(request).execute()) {
|
try (Response response = client.newCall(request).execute()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user