I believe that many webmasters will first perform local tests when performing the tests. Generally, localhost or 127.0.0.1 is used to access the local environment. What is the difference between localhost and 127.0.0.1? Which one is better?
Many people think that these two are completely the same, and some people think 127.0.0.1 is better, because it is a local IP address and does not need to be resolved from the domain name. In fact, these two are very different:
Localhost is also called local. The correct explanation is: local server
The correct explanation of 127.0.0.1 in the system is: local address (local server)
Localhot (local) is transmitted without a Nic! This is important because it is not restricted by network firewalls and network adapters. Access to localhost will not be resolved to an ip address, and will not occupy Nic or network resources.
127.0.0.1 depends on the network card and is restricted by the network firewall and network card.
This is why it is sometimes accessible using localhost, but not 127.0.0.1.