大网数据广告活动
网站运营与故障问答

Can DNS point to specific port?

· 52CE 我爱测

I got virtual machine on some server and my URL is something like this. 111.11.11.111:8002 Can I get DNS who will point to specific port ? One more thing. If I cant do that, can my virtual machine on server be sub-domain of that …

问题原文

原帖链接 · Ivan Vulović · CC BY-SA 3.0

I got virtual machine on some server and my URL is something like this.

111.11.11.111:8002

Can I get DNS who will point to specific port ?

One more thing. If I cant do that, can my virtual machine on server be sub-domain of that server DNS ?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

DNS has no concept of ports for older protocols such as HTTP, HTTPS, and SSL. DNS only points to the IP address.

The port to connect to for a particular service is determined by convention. For example the default port for HTTP is 80, the default port for HTTPS is 443, and the default port for SSH is 22.

The only way to override the default port is to specify it in the URL (or on the command line for something like SSH). There is no way to specify port numbers in DNS. If you are running a website, your server must respond to HTTP requests on port 80 if you don't want to have an ugly port number in the URL.


It is not clear to me exactly what you are trying to accomplish.

If you want to run multiple sites on the same server, that is usually possible. You can run multiple sites from different domains or different subdomains all in the same server. You need to configure virtual hosts for that to work.

You may need to run a second server that runs a different technology (for example Tomcat to run Java or a Rails server to run Ruby). In that case, it is common to connect your additional server to your main server using a reverse proxy to remove the port number from the URL.

If you are trying to host your site at home and your ISP is blocking port 80, then you are out of luck. Your only options are to find different hosting or have a port number in the URL.


There is a newer innovation that allows port numbers to be specified by DNS: SRV Records. However, SRV records only work with new protocols that say to use SRV lookups in their specification. Older protocols such as HTTP and HTTPS will continue to use their current port numbers and won't support SRV.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2013-11-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。