我的共享主机的名称服务器如何将 http://servername.com/~username/ 解析为我的顶级域?
我最近将我的网站转移到 asmallorange.com 的共享托管解决方案,但我必须将我的域设置为使用他们提供的名称服务器以便站点正确解析。 我决心保持对域 DNS 的控制,但我找不到任何方法可以使我的顶级域解析到共享位置,其格式为“
server.asmallorange.com/~username
所以我知道我在这里遗漏了一些东西,我的问题是这样的:
他们的名称服务器/DNS 条目中的哪些内容使 server.sharedhost.com/~username 能够充当顶级域? (即http://topleveldomain.com)
I recently moved my website to a shared hosting solution at asmallorange.com, but I had to set my domain to use their provided nameservers in order for the site to properly resolve. I was determined to keep control of the domain's DNS but I could find no way to make my top level domain resolve to the shared location which was in the format of
server.asmallorange.com/~username
So I know I'm missing something here, my question is this:
What in their nameservers/DNS entry makes it possible for server.sharedhost.com/~username to serve as a top level domain? (ie. http://topleveldomain.com)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有什么。 DNS 只是将 topleveldomain.com 映射到 server.sharedhost.com。 网络服务器查看
Host: topleveldomain.com
标头并知道它相当于 server.sharedhost.com/~username。Nothing. DNS simply maps topleveldomain.com to server.sharedhost.com. It's the webserver which looks at the
Host: topleveldomain.com
header and knows that's equivalent to server.sharedhost.com/~username.没有什么。 他们将您的域名解析为与 server.asmallorange.com 解析为相同的 IP,但随后他们让 Web 服务器知道域名 topleveldomain.com,并告诉 Web 服务器它与 server.asmallorange 相同.com/~用户名。
虚拟主机不是 DNS 技巧,它们是 HTTP 技巧 - 请求的主机名由浏览器在每个请求的 Host: 字段中发送。
Nothing. They are having your domain name resolve to the same IP that server.asmallorange.com resolves to, but then they are making their web server aware of the domain name topleveldomain.com, and telling the webserver that it is the same as server.asmallorange.com/~username.
Virtual hosts aren't a DNS trick, they're an HTTP trick - the hostname requested is sent by the browser in a Host: field of every request.
Apache 中的虚拟主机就是这样做的。
然而,仅仅因为您将 DNS 设置为“mydomain.com 解析为 1.2.3.4”(即他们的 IP 地址),并不意味着您放弃对域名的控制。
Virtual Hosts in Apache are how this is done.
However just because you set the DNS up to go "mydomain.com resolves to 1.2.3.4", which is their IP address, doesn't mean that you're giving up control of your domain name.
apache 有一个“mod_user”,您可以在 apache conf 文件中启用它。 使用这个和虚拟主机就是实现这一点的。
apache has a "mod_user" which you can enable in your apache conf file. Using this and virtual hosts is how that is accomplished.