【问题标题】:curl: The URI prefix is not recognizedcurl:无法识别 URI 前缀
【发布时间】:2020-05-29 10:21:55
【问题描述】:

当我想检查我的端口时,它只允许我的第 80 个端口。我也试过http://。是一样的。我无法检查特定端口。检查屏幕截图。我的操作系统是 Windows 10 Pro,这是 Powershell。我也在 CMD 上检查过。我正在共享包含我的代码的代码和图像。

curl localhost  /* ( It shows the information as in image, there is no problem with default port 80) */

curl localhost: 8080  //(httpd's port as i assigned)
curl: The URI prefix is not recognized.

curl localhost: 3306 // (mysql's port as i assigned)
curl: The URI prefix is not recognized.

enter image description here

【问题讨论】:

  • 请不要将文字作为图片发布。另外,你没有给 curl 一个 URL 类型前缀(比如http://),告诉它使用哪个协议。
  • 阿米泰你好,代码很多,所以我只添加了部分代码。我试过 http:// 它也不起作用。
  • 编辑您的问题以反映您的尝试。您无法获得与您未提出的问题相关的答案。此外,主机名和端口号之间的空格应删除:curl http://localhost:8080
  • 这就是我喜欢这个网站的原因!非常感谢阿米泰!它以这种方式工作。最好的问候。

标签: docker containers port


【解决方案1】:

curl 的正确调用需要在 URL 中包含协议标识符,并且端口需要附加到主机名中,并带有冒号且不包含空格。例如,要访问本地主机上的 HTTP 服务器,通过端口 8080 提供服务,您需要使用:

curl http://localhost:8080

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 2020-03-23
    • 1970-01-01
    • 1970-01-01
    • 2013-07-26
    • 1970-01-01
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多