我在端口5000上的基于Centos 7的VM中运行节点应用程序。当我在VM中打开浏览器时,我可以访问http://localhost:5000。我也在Virtualbox中转发端口5000 / TCP。直到最近,我才能在我的主机上访问相同的URL。我可以通过SSH进入机器,所以我可以认为客人的加入不应该受到责备。
当我从主机卷曲时,我得到以下输出:
curl -v http://localhost:5000
* Rebuilt URL to: http://localhost:5000/
* Trying ::1...
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5000 (#0)
> GET / HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/7.46.0
> Accept: */*
>
* Recv failure: Connection was reset
* Closing connection 0
curl: (56) Recv failure: Connection was reset
来宾的卷曲成功:
curl -v localhost:5000
* About to connect() to localhost port 5000 (#0)
* Trying ::1...
* Connected to localhost (::1) port 5000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:5000
> Accept: */*
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache="Set-Cookie, Set-Cookie2"
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< Content-Type: text/html; charset=utf-8
< Content-Length: 13545
< ETag: W/"34e9-XRkZVDhS9RNYciepFhTD7A"
< Vary: Accept-Encoding
< Date: Wed, 10 Aug 2016 17:11:16 GMT
< Connection: keep-alive
<
<!DOCTYPE html>...
端口转发设置如下所示 - 只有SSH工作,虽然我已经尝试添加和删除主机IP到我想要访问的服务。
如何进一步排查?
这可能是最新版Virtualbox的问题吗?
答案 0 :(得分:1)
在VM机中停止防火墙守护程序对我来说是可行的。谢谢@哈里·金
sudo systemctl停止firewalld
禁用前的卷曲结果:
* Recv failure: Connection was reset
* Closing connection 0
curl: (56) Recv failure: Connection was reset
禁用后:
< HTTP/1.1 404
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Fri, 30 Oct 2020 06:47:43 GMT
<
{"timestamp":1604040463217,"status":404,"error":"Not Found","message":"No message available","path":"/"}* Connection #0 to host 127.0.0.1 left intact