Difference between localhost and 127.0.0.1: localhost127.0.0.1
No1:
Localhost is also called local. The correct explanation is: local server
127.0.0.1 in windows and other systems, the correct explanation is: local address (local server)
Their parsing uses the host file of the local machine, and windows automatically resolves localhost to 127.0.0.1
No2:
Localhot (local) is transmitted without a Nic! This is important because it is not restricted by network firewalls and network adapters.
127.0.0.1 is transmitted through the NIC and depends on the NIC. It is subject to network firewall and nic restrictions.
The IP address of the local machine is also transmitted through the NIC, which depends on the nic and is restricted by the network firewall and nic.
However, the difference between the local IP address and 127.0.0.1 is:
127.0.0.1 can only be accessed from the Local Machine
The local IP Address can also be accessed through the local host.
Generally, it is best to use localhost for local services when setting a program. localhost will not be resolved to an ip address, nor will it occupy Nic or network resources.
Sometimes you can use localhost, but you cannot use 127.0.0.1. This is the case. Assume that when localhost is accessed, the current user's permissions on the local machine are used to access the local machine. When an ip address is used, the local machine accesses the local machine through the network and the network user's permissions are used.