如何为另一台主机设置子域?
大家好,我最近购买了一个便宜的 vps 来玩,以习惯使用 Linux、命令行和服务器。
我还有一个共享虚拟主机,用于托管我的网站。
现在,我想将我的网站保留在我的共享虚拟主机上,直到我完全了解如何使用我的 vps,然后我将慢慢开始移动项目,等等。
所以我已经将我的域(即domain.com)连接到我的共享主机。但我想为我的 vps 分配一个子域,这可能吗?喜欢 vps.domain.com 吗?
例如,我正在设置 webmin,我可以设置我的域吗,当我转到 vps.domain.com:10000 时,它实际上会转到该网站(我不是指重定向),就好像我要去它的IP http://00.000.000.000:1000?
我该怎么做?我从 namecheap 购买了域名,我的共享虚拟主机正在使用 cpanel,如果你们需要,我可以提供更多信息。
Hey guys, so I recently purchased a cheap vps for me to play around with, to get used to working with linux, command line, and servers.
I also have a shared webhost that I host my site on.
For now, I want to keep my site on my shared webhost until I fully find out how to work with my vps, then I'll slowly start moving projects, ect over.
So I have my domain, (I.E domain.com) connected or whatever to my shared host. But I want to like, assign a subdomain to my vps, is this possible? Like vps.domain.com?
For example, I was setting up webmin, can I set up my domain for when I go to vps.domain.com:10000, it actually goes to the site, (and I don't mean redirection), as if I were going to it's ip http://00.000.000.000:1000?
How can I do this? I bought my domain from namecheap, and my shared webhost is using cpanel, I can provide more information if you guys need.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您只需为
vps.example.com
创建一条 A 资源记录。通常,您可以在注册example.com
的提供商的配置面板中执行此操作。You just need to create an A resource record for
vps.example.com
. Usually you can do that in the configuration panel of the provider you've registeredexample.com
with.当我想将子域重定向到其他地方时,我在 DNS 的区域文件中创建一条“A 记录”。
“A 记录”最常用于将主机名映射到主机的 IP 地址。
在您的情况下,“A 记录”将类似于“vpn”=> 255.255.255.255
When i want to redirect a subdomain to somewhere else, i'm creating a "A record" in the zone file of the DNS.
"A record" are most commonly used to map hostnames to an IP address of the host.
In your case the "A record" will be something like "vpn" => 255.255.255.255
由于您可以在 DNS 设置中创建子域,因此没有问题,像 freedns.ws 这样的工具对此很有帮助。
只需登录,创建一个子域并将VPS的DNS记录分配给该子域,您还可能需要在主域名记录中添加新记录,因为默认情况下您有*.domainname.com,这意味着所有子域,您可以添加新的子域并将其指向 VPS。
我想应该可以做到
Since you can create subdomain in DNS settings there is no problem, tools like freedns.ws are kind of good for this.
Just Login, create a subdomain and have the DNS records of the VPS assigned to the subdomain, also you may need to add a new record to the main domain name record, cause by deafult you have *.domainname.com which means all subdomain, you can add the new subdomain and have it point to the VPS.
I guess that should do it