localhost
localhost是 127.0.0.1的域名訪問,規(guī)則在/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
實際測試為 如果程序發(fā)布在127.0.0.1 局域網(wǎng)內(nèi)是訪問不到的。除非你綁定到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).
本機(jī)ip
是針對外網(wǎng)而言的。
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/