curl: (7) Failed to connect to port 80, and 443 - on one domain

101,577

Solution 1

After many search, I found that Hosts settings not correct

Then I check nano /etc/hosts The Domain point to wrong IP in hosts file

I change the wrong IP and its working Fine

This is new error Related to curl: (7) Failed to connect

Solution 2

First Check your /etc/hosts file entries, may be the URL which You're requesting, is pointing to your localhost.

If the URL is not listed in your /etc/hosts file, then try to execute following command to understand the flow of Curl Execution for the particular URL:

curl --ipv4 -v "https://example.com/";

Solution 3

curl: (7) Failed to connect

The above error message means that your web-server (at least the one specified with curl) is not running at all — no web-server is running on the specified port and the specified (or implied) port. (So, XML doesn't have anything to do with that.)

Share:
101,577

Related videos on Youtube

Mitra
Author by

Mitra

Updated on May 17, 2021

Comments

  • Mitra
    Mitra about 3 years

    This question shows research effort; it is useful and clear

    I have checked the cURL not working properly

    When I run the command curl -I https://www.example.com/sitemap.xml

    curl: (7) Failed to connect
    
    Failed to connect on all port
    

    this error only on one domain, all other domain working fine, curl: (7) Failed to connect to port 80, and 443

    Thanks...

  • Mitra
    Mitra almost 7 years
    Hi, Thanks for answer, but this error only on one domain, all other domain working fine, curl: (7) Failed to connect to port 80, and 443
  • cnst
    cnst almost 7 years
    @Mitra So, then what's your question, again?!