"localhost",主机和端口的全部含义是什么? [英] What's the whole point of "localhost", hosts and ports at all?

查看:999
本文介绍了"localhost",主机和端口的全部含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这个Web开发工作完全陌生.所以我经常看到类似"localhost"之类的东西,然后问自己:那是什么?

I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that?

我想知道什么是主机".执行某事的东西.因此,我的mac是运行在其上的所有内容的主机.因此,"localhost"实际上只是我的mac?我还可以有其他主持人吗?像"otherhost"还是"betterhost"?

I feel to know what a "host" actually is. Something that executes something. So my mac is the host for everything that runs on it. So "localhost" is actually just my mac? Can I have also other hosts? like "otherhost" or "betterhost"?

因此,当我在浏览器中书写时: http://localhost:80/mysite/index.php ,这个本地主机"告诉浏览器在我的机器上查找这些东西,而不是在线吗?

So when I write in my browser: http://localhost:80/mysite/index.php, this "localhost" thing tells the browser to look on my machine for that stuff rather than online?

也许有人可以清除一下:-)

Maybe someone can clear this up a little bit :-)

推荐答案

在计算机网络中,localhost(意为此计算机")是为回送网络接口地址指定的标准主机名.

In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface.

Localhost始终将IPv4中的回送IP地址转换为127.0.0.1.

Localhost always translates to the loopback IP address 127.0.0.1 in IPv4.

它也用于代替计算机的主机名.例如,将安装在运行HTTP服务器的系统上的Web浏览器定向到 http://localhost ,将显示本地计算机的主页.网站.

It is also used instead of the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site.

来源:维基百科-Localhost .

:80部分是TCP端口.您可以将这些端口视为特定IP地址上的通信终结点(对于localhost-127.0.0.1). IANA 负责维护特定服务的标准端口号的正式分配.端口80恰好是 HTTP 的标准端口.

The :80 part is the TCP port. You can consider these ports as communications endpoints on a particular IP address (in the case of localhost - 127.0.0.1). The IANA is responsible for maintaining the official assignments of standard port numbers for specific services. Port 80 happens to be the standard port for HTTP.

这篇关于"localhost",主机和端口的全部含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆