我可以使用/etc/hosts 映射主机名 * 和 * 端口吗? [英] Can I map a hostname *and* a port with /etc/hosts?

查看:32
本文介绍了我可以使用/etc/hosts 映射主机名 * 和 * 端口吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将像 127.0.0.1 这样的 IP 地址映射到域名端口吗?

Can I map an IP address like 127.0.0.1 to a domain name and a port?

例如,我想将 127.0.0.1 映射到 api.example.com:8000

For example, I would like to map 127.0.0.1 to api.example.com:8000

推荐答案

不,这不可能.端口不是主机名的一部分,因此它在 hosts 文件中没有意义.

No, that's not possible. The port is not part of the hostname, so it has no meaning in the hosts-file.

这篇关于我可以使用/etc/hosts 映射主机名 * 和 * 端口吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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