![](/img/trans.png)
[英]Symfony - Guzzle request: cURL error 6: Could not resolve host
[英]Curl ends with “curl: (6) Could not resolve host: HTTP”
我一直在關注如何使用 nginx 編譯 modsecurity 的博客, 博客。 我試圖驗證創建文件/etc/nginx/conf.d/echo.conf
是否一切正常,其中包含:
server {
listen localhost:8085;
location / {
default_type text/plain;
return 200 "Thank you for requesting ${request_uri}\n";
}
}
我在 cmd 中運行了以下命令:
sudo nginx -s reload
curl -D - http://localhost:8085 HTTP/1.1 200 OK
我得到了
HTTP/1.1 200 OK
Server: nginx/1.19.0
Date: Wed, 10 Jun 2020 19:31:08 GMT
Content-Type: text/plain
Content-Length: 27
Connection: keep-alive
Thank you for requesting /
curl: (6) Could not resolve host: HTTP
我已經做了幾個小時了,不知道該怎么做。 我發現的兩個解決方案是
我用 --ipv4 curl --ipv4 -D - http://localhost:8085 HTTP/1.1 200 OK
在 cmd 中運行命令。 我還將/etc/resolv.conf
中的名稱服務器更改為 8.8.8.8 而不是 127.0.0.53 這也不起作用。
關於做什么的任何線索?
該錯誤消息是由於您使用的命令語法而產生的。 使用curl
時,運行以下命令就足夠了:
curl -D - http://localhost:8085
向您定義的網絡服務器(在本例中為localhost
)發出 HTTP 請求。 否則,如果沒有其他要解析的選項,它將需要額外的 arguments 作為額外的 URL 來查詢,因此它會嘗試查詢HTTP
,就好像您輸入http://HTTP
例如/etc/hosts
中 HTTP 主機的條目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.