curl: (52) Empty reply from server

15,855 阅读1分钟

在查看es启动状态时,使用curl -XGET http://localhost:9200指令,结果显示

image.png

使用curl -v查看 curl 在 Container 中的执行日志

[root@09:10 /]# curl -v http://localhost:9200
* About to connect() to localhost port 9200 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9200 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9200
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

curl: (52) Empty reply from server 原因可能有以下几点:

1、特殊字符&被截断:

curl https://freexyz.cn/?c=dingshi&a=fBuNews
改为
curl "https://freexyz.cn/?c=dingshi&a=fBuNews"

2、http协议问题:

有些朋友遇到的是协议不对,导致访问返回curl: (52) Empty reply from server,更改对应的协议即可 修改成https便成功访问

image.png

3、防火墙或者网络问题:

有时候服务器的防火墙会拦截一些请求,还有就是网络不通导致访问异常

Linux curl命令详解