Tag Archives: curl: (7) couldn’t connect to host

curl: (7) couldn’t connect to host [How to Solve]

Error when using curl command to visit website:

[root@bqh-119 ~]# curl -I www.test.com
curl: (7) couldn't connect to host
[root@bqh-119 ~]# curl -V #Query version and supported protocols
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 

First, if you can’t Ping the website, go to/etc/hotspot and add the address:

Then check whether the firewall is turned on or whether access rules are added

Curl is normal after closing the firewall. In many cases, it is caused by firewall rules interception, and of course, it is also caused by other configuration reasons