curl Failed to connect to localhost port 80

前端 未结 4 2101
醉梦人生
醉梦人生 2020-12-13 04:36

My hosts file maps 127.0.0.1 to localhost.

$ curl -I \'localhost\'
curl: (7) Failed to connect to localhost port 80: Connection re         


        
4条回答
  •  旧时难觅i
    2020-12-13 05:27

    Since you have a ::1 localhost line in your hosts file, it would seem that curl is attempting to use IPv6 to contact your local web server.

    Since the web server is not listening on IPv6, the connection fails.

    You could try to use the --ipv4 option to curl, which should force an IPv4 connection when both are available.

提交回复
热议问题