localhost
localhost是 127.0.0.1的域名访问,规则在/etc/hosts
127.0.0.1
127...* are the loopback IP addresses for most modern operating systems
and these IP addresses can be used to refer to our own computer.
0.0.0.0 vs 127.0.0.1
实际测试为 如果程序发布在127.0.0.1 局域网内是访问不到的。除非你绑定到0.0.0.0。
0.0.0.0, in this context, means "all IP addresses on the local machine" (in fact probably, "all IPv4 addresses on the local machine"). So, if your webserver machine has two ip addresses, 192.168.1.1 and 10.1.2.1, and you allow a webserver daemon like apache to listen on 0.0.0.0, it will be reachable at both of those IPs. But only to what can contact those IPs and the web port(s).
本机ip
是针对外网而言的。
ps
https://serverfault.com/questions/78048/whats-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1
https://www.howtogeek.com/225487/what-is-the-difference-between-127.0.0.1-and-0.0.0.0/
网友评论