本地主机:8080 是什么意思?

发布于 2024-10-14 19:47:32 字数 1819 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

国产ˉ祖宗 2024-10-21 19:47:32

TCP/IP 连接始终与 IP 地址建立(您可以将 IP 地址视为某台计算机的地址,即使情况并非总是如此) (而不是物理)该地址上的端口。

通常,一个端口耦合到目标计算机上的特定进程或“服务”。有些端口号是标准化的,例如 http 为 80,smtp 为 25 等等。由于这种标准化,您通常不需要将端口号放入您的网址中。

因此,如果您说 http://www.stackoverflow.com 之类的内容,“stackoverflow.com”部分将解析为 IP 地址(在我的情况是 64.34.119.12),因为我的浏览器知道该标准,所以它尝试连接到该地址上的端口 80。因此,这与 http://www.stackoverflow.com:80 相同。

但是没有什么可以阻止进程侦听另一个端口上的 http 请求,例如 12434、4711 或 8080。通常(如您的情况),这用于调试目的,以免与已经侦听的另一个进程(例如 IIS)混合在一起同一台机器上的 80 端口。

2021 年注释:当我发表这篇文章时,我使用端口 80 作为示例,因为尽管 OP 没有指定协议,但 http 是当时常见的 Web 请求标准,而 80 是 http 的标准。现在几乎所有东西都运行在 https 上,标准端口是 443。

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.

Note from 2021: When I made this post, I used port 80 as example because even though the OP didn't specify a protocol, http was the usual web request standard back then and 80 ist the standard for http. Nowadays pretty much everything runs on https and the standard port for that is 443.

孤檠 2024-10-21 19:47:32

localhost/web 等于 localhost:80/web127.0.0.1:80/web

localhost:8080/web< /code> 等于 localhost:8080/web127.0.0.1:8080/web

localhost/web is equal to localhost:80/web OR to 127.0.0.1:80/web

localhost:8080/web is equal to localhost:8080/web OR to 127.0.0.1:8080/web

深居我梦 2024-10-21 19:47:32

localhost:8080 表示您明确定位端口 8080。

the localhost:8080 means your explicitly targeting port 8080.

猫弦 2024-10-21 19:47:32

http 使用端口 80,可以理解的是,当您输入地址时,您的互联网浏览器将自动使用该端口 - 除非您指定其他端口。现在,当您的计算机上运行 Web 服务器时,您需要以某种方式访问​​该服务器 - 由于端口 80 已经繁忙,您需要使用不同的端口才能成功连接到它。尽管任何开放端口都是公平的,但通常此类服务器被配置为使用端口 8080,因此在访问服务器时,您输入:

http://(协议)
本地主机(您的计算机)
:8080(端口8080)
/(指向您服务器的公共文件夹根目录的路径)

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)

杯别 2024-10-21 19:47:32

http://localhost:8080/web

其中

  • localhost ( hostname ) 是主机服务器的计算机名称或 IP 地址,例如 Glassfish、Tomcat。
  • 8080 ( port ) 是主机服务器侦听请求的端口地址。

http://localhost/web

其中

  • localhost ( hostname ) 是主机服务器的计算机名称或 IP 地址,例如 Glassfish、Tomcat。
  • 主机服务器侦听默认端口 80

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.
人间不值得 2024-10-21 19:47:32

http://localhost:8080/web:localhost ( hostname ) 是主机服务器的计算机名称或 IP 地址,例如 Glassfish、Tomcat。
8080(端口)是主机服务器侦听请求的端口地址。

http://localhost/web:localhost ( hostname ) 是主机服务器的计算机名称或 IP 地址,例如 Glassfish、Tomcat。
主机服务器侦听默认端口 80。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文