php curl no route to host

Ошибка curl: нет маршрута к хосту

Итак, мы создаем веб-приложение на PHP и пытаемся делать запросы к внешнему API. Проблема в том, что мы получаем ошибку curl:

Ошибка cURL 7: не удалось подключиться к порту 443 external.api.com: нет маршрута к хосту

А теперь немного предыстории.

Мне удалось запустить его в двух разных средах разработки, но не в производственной. Я подозреваю, что проблема в конфигурации Apache, как будто мы не сделали его доступным для выполнения запросов к определенному IP или порту. Понятия не имею, как это проверить. Я читал, что мне, возможно, придется изменить файл / etc / network / interface, но я не нашел никакой информации о том, что там писать.

РЕДАКТИРОВАТЬ:

Невозможно даже сделать простой запрос на получение без каких-либо параметров и прочего. Тем не менее я могу делать запросы к https://google.com и https://facebook.com. Напишу больше через несколько.

3 ответа

После долгой отладки и тестирования всего моего кода я связался со службой, чей API я пытался использовать.

Они были европейским поставщиком услуг и занесли европейские IP в белый список. Наш производственный сервер находился в США, и после того, как они добавили наш IP-адрес в белый список, все заработало.

И это ошибка Failed to connect to ::1: No route to host

Наконец-то я решил это. Очевидно, это проблема вашего Apache Tomcat. Поэтому сначала вы должны проверить свои журналы. Если вы обнаружили, что ваш порт был использован, найдите этот курс и убейте его. Затем перезапустите свой кот.

Где бы он ни находился, ваш файл конфигурации должен содержать что-то вроде следующего:

После изменения этого файла не забудьте sudo service nginx reload или sudo service nginx restart (или соответствующую команду apache).

Источник

PHP Solutions

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

No route to host

Often, when we get error “No route to host” to connect remote server via linux command line e.g. wget, curl etc. or web services (webserviceserver).

The first solution we want to try to troubleshot firewalls and proxies?

But before that try hostname entry in linux box…

# vi /etc/hosts
add & save
192.168.0.100 webserviceserver

If still experienced the issue when deploying code from development machine to a live server.

Ping other servers like
# ping google.com
# wget http://www.google.com

If ping & wget working for google means the webserviceserver have some block or restrictions to calling servers.

Make sure with several linux network utilities

# nc webserviceserver.com 8080
webserviceserver.com [192.168.0.100] 8080 (www) : No route to host

# telnet 192.168.0.100 8080 (working?)

# traceroute www.webserviceserver.com (working?)

# ping www.webserviceserver.com (working?)

Make sure we are using a router and not a proxy server. Proxy servers are good for Internet browsing but not for ftp, sending ICMP request and so on.

Try on alternate port..
# nc webserviceserver.com 8078

If this is working then we have to use alternate port for the server “webserviceserver.com”

Make alternate port for network connection 🙂

Источник

curl no route to host

So we’re building a web application in PHP and we’re trying to make requests to an external API. Problem is that we’re getting a curl error:

cURL error 7: Failed to connect to external.api.com port 443: No route to host

A little bit of background now.

I’ve managed to get it running on two different development environments but not on the production one. I suspect the problem is in the configuration of Apache, as if we haven’t made it available to make requests to certain IP or port. I have no idea how to check it. I’ve read that I might have to change the file /etc/network/interface yet I haven’t found any info on what to write there.

подключение к сокету:

Ошибка:
[Errno 113] No route to host
Все перепробовал, добавлял rule для firewall но не помогло. Отключать firewall нельзя так как gitlab-runner не будет работать.

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

chupasaurus, network_mode не установлен. Установил утелиту tcping на centos.
Запускаю команду:

Запускаю туже команду на локалке mac:

Но в чем не понятная/мистическая штука в том что данный код на продакшене (Centos 7) иногда работает.

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

Are you new to LinuxQuestions.org? Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to hostIntroduction to Linux — A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author’s experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Источник

OpenVPN: the No route to host and ERR_ADDRESS_UNREACHABLE errors – the cause and a solution

We have an OpenVPN Access Server running, see its setup in the OpenVPN: OpenVPN Access Server set up and AWS VPC peering configuration post.

The VPN server is hosted in a first AWS VPC, while a Bitwarden service – in another one VPC.

Between those VPCs we have a VPC peering configured, and the OpenVPN has to route traffic between users and the Bitwarden host.

The problem is that if try to access the Bitwarden host (see the Bitwarden: an organization’s password manager self-hosted version installation on an AWS EC2 post about its setup) – we have the”ERR_ADDRESS_UNREACHABLE/No route to host” error:

Check the IP of the Bitwarden’s URL:

172.31.41.159 – okay, it is resolved to a private IP, all good here (see the AWS: VPC peering DNS resolution and DNS settings for OpenVPN Access Server for details about DNS resolution setup).

Now, check the NAT rules in the OpenVPN server admin page – do we have a route to the 172.31.16.0/20 network:

php curl no route to host. Смотреть фото php curl no route to host. Смотреть картинку php curl no route to host. Картинка про php curl no route to host. Фото php curl no route to host

Okay – the route is added.

Check a local route table:

And here is our route – looks good? But still doesn’t work.

Check the hosts in this network:

And pay attention to the HostMax: 172.31.31.254, while our Bitwarden host hosted in the 172.31.41.0/24 subnet.

So, the solution could be to set a 172.31.31.0/18, subnet in the OpenVPN AS NAT routes, or to use 172.31.41.0/24.

Set it to the 172.31.41.0/24, re-connect and check local routes now:

Источник

Ошибка No route to host при установке Laravel с помощью Composer?

Имеется WEB сервер на ubuntu + LAMP, в интернет выходит через прокси Squid (отдельная машина).
Хочу попробовать Laravel.

1. Глобально установил Composer

2. Далее в /var/www/html/ скачал Laravel

3. Дальше процесс не идёт, при диагностике
sudo composer diag
имею такую картину

В логах Squid появляется следующий запрос:

Собственно, при
sudo composer install
ответ

Как я понимаю, прокси блокирует пустой «анонимный» запрос (могу ошибаться). Проблема скорее всего на моём web-сервере.
http_proxy, https_proxy прописаны, сама ubuntu и apt интернет видят.

Прокси администрирую не я, но могу попросить подкорректировать правила.

Что и где мне посмотреть/поменять?

Обратите внимание, что представленный лог от прокси показывает http протокол, а в запросе httpS. Сдается мне, что дело в этом.

Вы уверены, что прокся работает через httpS? Если таки работает, то импортирован ли ее сертификат в систему? Если импортирован, то умеет ли composer работать со сторонними сертификатами или же в ней зашит сертификат и он не может работать с другими? Если умеет, то видит ли импортированный?

Пробуйте выяснить как на проксе (шлюзе) ходят https пакеты. Попросите админа прокси временно дать доступ на прямую по 443 порту, в обход прокси, скорее всего заработает. Проверьте, работает ли https в самой системе

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *