相关疑难解决方法(0)

curl无法连接到localhost端口80

我的主机文件映射127.0.0.1localhost.

$ curl -I 'localhost'
curl: (7) Failed to connect to localhost port 80: Connection refused
Run Code Online (Sandbox Code Playgroud)

然后

$ curl -I 127.0.0.1
HTTP/1.1 200 OK
Server: nginx/1.2.4
Date: Wed, 09 Apr 2014 04:20:47 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 23 Oct 2012 21:48:34 GMT
Connection: keep-alive
Accept-Ranges: bytes
Run Code Online (Sandbox Code Playgroud)

在我的主机文件中,我有

127.0.0.1   localhost
Run Code Online (Sandbox Code Playgroud)

看来curl命令无法识别输入 /etc/hosts.有人可以解释原因吗?

更新:我还没试过这个,但我发现你可以配置nginx来响应ipv4和ipv6

curl nginx

30
推荐指数
3
解决办法
12万
查看次数

标签 统计

curl ×1

nginx ×1