问题
What is the difference between localhost/web vs. localhost:8080/web?
回答1:
A TCP/IP connection is always made to an IP address (you can think of an IP-address as the address of a certain computer, even if that is not always the case) and a specific (logical, not physical) port on that address.
Usually one port is coupled to a specific process or "service" on the target computer. Some port numbers are standardized, like 80 for http, 25 for smtp and so on. Because of that standardization you usually don't need to put port numbers into your web adresses.
So if you say something like http://www.stackoverflow.com, the part "stackoverflow.com" resolves to an IP address (in my case 64.34.119.12) and because my browser knows the standard it tries to connect to port 80 on that address. Thus this is the same as http://www.stackoverflow.com:80.
But there is nothing that stops a process to listen for http requests on another port, like 12434, 4711 or 8080. Usually (as in your case) this is used for debugging purposes to not intermingle with another process (like IIS) already listening to port 80 on the same machine.
回答2:
Option 1
localhost/web is equal to localhost:80/web OR to 127.0.0.1:80/web
Option 2
localhost:8080/web is equal to localhost:8080/web OR to 127.0.0.1:8080/web
回答3:
the localhost:8080
means your explicitly targeting port 8080.
回答4:
http uses port 80, and understandably, your internet browser will automatically use that port when you type in an address - unless you specify another port. Now, when running a web server on your computer, you need to access that server somehow - and since port 80 is already busy, you need to use a different port to successfully connect to it. Although any open port is fair game, usually such a server is configured to use port 8080, hence when accessing your server you type in:
http:// (protocol) localhost (your computer) :8080 (port 8080) / (path pointing to the root of the public folder of your server)
回答5:
http: //localhost:8080/web
Where
- localhost ( hostname ) is the machine name or IP address of the host server e.g Glassfish, Tomcat.
- 8080 ( port ) is the address of the port on which the host server is listening for requests.
http ://localhost/web
Where
- localhost ( hostname ) is the machine name or IP address of the host server e.g Glassfish, Tomcat.
- host server listening to default port 80.
回答6:
http://localhost:8080/web: localhost ( hostname ) is the machine name or IP address of the host server e.g Glassfish, Tomcat. 8080 ( port ) is the address of the port on which the host server is listening for requests.
http://localhost/web: localhost ( hostname ) is the machine name or IP address of the host server e.g Glassfish, Tomcat. host server listening to default port 80.
来源:https://stackoverflow.com/questions/4822965/what-does-localhost8080-mean