我在我的raspberry pi (rpi)上运行一个服务器,在我的raspberry pi (rpi)上运行一个服务器。port 8088
.
服务器是rustactix,我运行它与 cargo run
.
我用 ssh [email protected]
我跑 curl localhost:8088
. 服务器返回200 OK和一个index.html文件。正如预期的那样。
我使用 hostname -I
找到rpi的IP地址 192.168.0.25
还有这个 172.17.0.1
.
当我进入同一本地网络上的另一台设备并运行 curl 192.168.0.25:8088
或 curl raspberrypi.local:8088
我得到 ERR_CONNECTION_REFUSED(连接)。
如果我跑 curl 172.17.0.1:8088
我得到 ERR_CONNECTION_TIMED_OUT。
我如何从本地网络上的另一台机器访问运行在raspberry pi上的服务器?
感谢评论中的回答,我注意到我把ip绑定到了...。localhost
.
通过将其绑定到 0.0.0.0
问题解决了,我可以从外部访问服务器了。