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

Viewed 127118

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...

5 Answers

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/";

you can download the key with browser then open terminal in downloads then type sudo apt-key add <key_name>.asc

Mine is Red Hat Enterprise(RHEL) Virtual Machine and I was getting something like the following.

Error "curl: (7) Failed to connect to localhost port 80: Connection refused"

I stopped the firewall by running the following commands and it started working.

sudo systemctl stop firewalld
sudo systemctl disable firewalld
Related