访问网站不仅仅是输入域名并按Enter键。在幕后,还涉及其他层来保护您在网上冲浪时的隐私和安全。
来自浏览器的Internet(Internet)请求无法读取域名。相反,他们只了解注册到这些域的数字 IP 地址。域名(D)服务器(N)或DNS是浏览器获取与域关联的正确 IP地址的地方(S)。(DNS)
即使您将网站移至新的托管服务提供商,您网站的DNS配置设置仍允许访问者访问您的网站。(DNS)
什么是网站 DNS 配置设置以及如何设置它们(What Are Website DNS Configuration Settings & How To Set Them Up)
对于大多数人来说,域名比一串数字更容易记住。对于互联网上的服务器和计算机,情况正好相反。DNS服务器处理翻译,以便双方都满意。
您的家庭网络通常依赖ISP提供的DNS服务器来获取您自己的互联网路由器的 IP 地址。您实际上可以修改路由器的 IP 设置,以将您的DNS服务器从自动(由您的ISP定义)切换到像 Google 的 DNS(public like Google’s DNS) 8.8.8.8 和 8.8.4.4 这样的公共服务器。
网站的DNS设置与此稍有不同。网站 DNS(Website DNS)配置设置对网站所有者很重要。每当(Anytime)您选择更改网络主机时,您就是在更改站点所在的物理服务器。这也意味着您正在更改 IP 地址。
修改您的DNS配置设置以始终将寻找您的域名的人指向正确的 IP 地址,即使在切换到新主机时也能保持网站正常运行。
大多数网站所有者需要了解的是,如果DNS设置输入错误,可能会导致整个网站长时间瘫痪。
请记住,DNS更改不是即时的,因此如果您犯了错误,在您的更正被复制到Internet 上的所有DNS服务器之前,很可能没有人可以访问该站点。(DNS)即使在修复错误后,更正也可能需要长达 72 小时才能生效。
防止 DNS 配置错误(Preventing DNS Configuration Mistakes)
为了防止错误发生,请确保您对A、CNAME、NS、TXT和MX记录的作用有基本的了解。
- A – A 记录也称为IPv4地址记录。它用于将域名指向一个或多个 IP 地址。如果您碰巧使用的是WordPress.com之类的托管托管服务提供商,并且还使用了他们的域名服务器,那么您将不需要 A 记录。
- CNAME – 这是规范名称 ( CNAME ) 记录。如果您已经有 A 记录,则不会使用CNAME。CNAME记录告诉访问子域的任何人也使用与另一个域或子域相同的DNS记录。(DNS)
当从一个 IP 地址运行多个服务时,这种事情很方便。CNAME 记录仅适用于子域,并且必须始终指向另一个域或子域,而不是直接指向 IP 地址。
- NS – 这些记录是名称服务器。没有这些,您的网站将根本无法运行。通常,您的DNS配置设置中至少有两个这样的记录。如果您从未更改过您的,它们可能看起来非常通用,例如 ns1.name.com 和 ns2.name.com。
NS记录(L)由顶级(D)域(TLD)( TLD ) 服务器存储(.gov),有超过 1000 个。这些是您的 .com、.gov(T)、.net和其他更常见的。NS 记录对域的定向和重定向具有最终控制权。
- MX – 这些是您的邮件交换(Mail Exchange)记录。它们用于从域创建电子邮件地址。MX 记录将指示邮件服务器接受您域的传入邮件以及收到的电子邮件应路由到的位置。
尽管您可能会遇到更多记录,但这些是您应该知道的更重要的记录。
配置 DNS 配置设置(Configuring DNS Configuration Settings)
在本教程中,我们将使用Hostinger作为我们的网络主机。登录到您的帐户并导航到Domains,然后是DNS Zone选项卡。
在这里,您可以找到所有DNS记录。
要修改这些记录中的任何一个,请单击其中任何一个右下角的Add New +按钮。
真的就是这么简单。为了进一步了解您正在查看的内容以及如何修改它们,让我们使用 A 记录。
A记录中的@是你的域名,指向(Points to)的是IP地址。通过更改此设置,您会将流向您的域名的所有流量重定向到您输入的 IP 地址。当移动到新的网站管理主机时,例如从WordPress到SquareSpace,您必须使用SquareSpace(Points to)提供的IP 地址更改@记录的指向(SquareSpace)。
输入主机名时,可以通过以下两种方式之一完成:
完整(Full)的主机名后跟一个句点 - full.hostname.com或完整的子域。
假设您想将您的WordPress域重定向到Hostinger域服务器。有两种方法可以做到这一点。第一种也是最简单的方法是在您的域名注册商处更改名称服务器。
推荐此方法的原因是您的DNS区域将自动配置为匹配主机的 IP 地址。这种方式还允许您将域设置的控制权转移到Hostinger hPanel。
- 您需要在 NS 部分的DNS 区域中找到名称服务器。(DNS Zone)
- 接下来,登录您的域名注册商的控制面板。如果您不熟悉或忘记了公司名称,可以使用whois 查找(whois lookup)。
- 在他们的DNS Zone版本中,从名称服务器字段中删除所有值并输入 Hostinger 的名称服务器。
- 然后保存(Save )更改。
此方法最多可能需要 24 小时才能使DNS完全传播。第二种方式更具技术性,因为您需要通过 A 记录指向域名。
您需要更改连接到DNS记录的 IP 地址。这将使您的域控制权保留在注册商中。如果您确定 IP 地址将保持静态,则不需要此过程。
修改A记录IP地址,将你的域名指向Hostinger。在大多数情况下,这将需要域的两条 A 记录——一条带有 www 子域,一条没有。
例如,如果您有一个名为 ilovecoffee.com 的域,并且您希望将其指向 212.1.212.65 作为其 IP 地址,您需要创建如下所示的 A 记录条目:
它可能看起来与您的注册商不同。只需(Just)填写类似的值,如图所示。这些字段将如下所示– Name/Host、TTL和Points to/Record。
平均生存时间(TTL)( TTL )值为(T)86400(T)秒(L),即 24 小时。当涉及到您应该将其设置为什么时,请查看其他记录条目。在这种情况下,我们的DNS设置显示 14400,即 4 小时。Hostinger下拉菜单中不存在 4 小时,因此建议使用平均值。
完成此步骤后,您可以继续更改电子邮件的 MX 记录。当然,仅当您当前使用主机提供的电子邮件服务器时才需要此步骤。
这个过程很简单。
- 前往DNZ Zone(DNZ Zone)中的 MX 记录并记下 Points to 字段。
- 获取该地址并将域目的地的 MX 记录替换为Hostinger的 MX 地址。
这里与 A 记录唯一不同的字段是Priority。此字段确定您拥有的每台服务器的优先级。最小的数字代表最高的优先级。如果您只有一台服务器,最好在优先级字段中放置一个介于 0 和 5 之间的数字。
如需有关DNS(DNS)配置设置的更多帮助和指导,请联系您的 Web 主机。许多事情,包括访问DNS配置,都可能因主机提供商而异。在没有得到帮助的情况下不要进行重大更改。
一旦掌握了窍门,对DNS(DNS)配置设置进行更改就会是一个简单而轻松的过程。
How To Set Up Website DNS Configuration Settings
There’s more that goеs into visiting a websitе than simply typing in the domain name and pressing the Enter key. Behind the scenes there are other layers involved to protect your privacy and seсurity while surfing online.
Internet requests from browsers can’t read domain names. They instead only understand numeric IP addresses registered to those domains. A Domain Name Server, or DNS, is where browsers go to get the correct IP address associated with a domain.
The DNS configuration settings of your website are what allows visitors to still access your site even after you move the site to a new hosting provider.
What Are Website DNS Configuration Settings & How To Set Them Up
For most people, domain names are a lot easier to remember than a sequence of numbers. For the servers and computers on the internet, the opposite is true. A DNS server handles the translation so that both parties are happy.
Your home network will typically rely on an ISP-supplied DNS server for your own internet router’s IP address . You can actually modify your router’s IP settings to swap your DNS servers from automatic (defined by your ISP) to something public like Google’s DNS 8.8.8.8 and 8.8.4.4.
A website’s DNS settings are a bit different than this. Website DNS configuration settings are important for website owners. Anytime you choose to change web hosts, you’re changing the physical server the site is on. This also means that you’re changing IP addresses.
Modifying up your DNS configuration settings to always point people looking for your domain name to the correct IP address will keep the website up and running even while swapping to new hosting.
The thing most website owners need to understand is that if DNS settings are entered incorrectly, the entire website can be brought down for a lengthy period of time.
Keep in mind that DNS changes are not instant, so if you make a mistake, it’s likely that no one will have access to the site until your correction is replicated across all DNS servers on the internet. Even after fixing the mistake, it could take up to 72 hours for the correction to take effect.
Preventing DNS Configuration Mistakes
To prevent mistakes from happening in the first place, ensure that you have a fundamental understanding of what A, CNAME, NS, TXT, and MX records do.
- A – The A record is also known as the IPv4 address record. It’s used to point the domain name at one or multiple IP addresses. If you happen to be using a managed hosting provider like WordPress.com and also use their nameservers, you won’t have a need for an A record.
- CNAME – This is the Canonical Name (CNAME) record. If you already have an A record, you will not use a CNAME. The CNAME record tells anyone visiting a subdomain to also use the same DNS records as another domain or subdomain.
This sort of thing is convenient when running multiple services from a single IP address. CNAME records only work for subdomains and must always point to another domain or subdomain and never directly to an IP address.
- NS – These records are the nameservers. Without these, your website won’t work at all. You’ll normally have at least two of these records in your DNS configuration settings. If you’ve never changed yours, they likely look very generic, like ns1.name.com and ns2.name.com.
The NS records are stored by the Top Level Domain (TLD) server, for which there are over 1000. These are your .com, .gov, .net, and the other more common ones. The NS record has ultimate control of where domains are directed and redirected.
- MX – These are your Mail Exchange records. They’re used to create email addresses from a domain. The MX records will direct mail servers to accept incoming mail for your domain and where received emails should be routed.
Although there are more records that you’re likely to encounter, these are the more important ones you should know.
Configuring DNS Configuration Settings
For this tutorial, we’ll be using Hostinger as our web host. Login to your account and navigate to Domains, and then the DNS Zone tab.
It’s here you’ll find all of your DNS records.
To modify any one of these records, click the Add New + button located at the bottom right of any of them.
It’s really that simple. To further understand what you’re looking at and how to modify them, let’s use the A record.
The @ in your A record is your domain name, and Points to is the IP address. By changing this, you’ll redirect all traffic headed to your domain name to the IP address you input. When moving to a new website management host, such as from WordPress to SquareSpace, you’d have to alter the Points to of the @ record using the IP address provided by SquareSpace.
When entering a hostname, it can be done in one of two ways:
Full hostname followed by a period – full.hostname.com or the full subdomain.
Let’s say that you want to redirect your WordPress domain to point to a Hostinger domain server. There are two ways you could go about doing this. The first and easiest way is through changing the nameservers at your domain name registrar.
The reason this method is recommended is that your DNS zone will automatically configure to match the hosting’s IP address. This way will also allow you to transfer control of your domain settings to the Hostinger hPanel.
- You’ll need to locate the nameservers in the DNS Zone which is in the NS section.
- Next, log in to your domain registrar’s control panel. If you’re unfamiliar or have forgotten the name of the company, you can use whois lookup.
- In their version of the DNS Zone, delete all values from the nameserver fields and input Hostinger’s nameservers.
- Then Save changes.
This method could take up to 24 hours for the DNS to fully propagate. The second way is more technical as you’ll need to point the domain name via A record.
You’ll need to change the IP address connected to the DNS records. This will keep your domain control in the registrar. If you know for certain that the IP address is going to remain static, this process isn’t necessary.
Modify the A record IP addresses and point your domain name to Hostinger. In most cases, this will require two A records for the domain – one with a www subdomain and one without.
An example would be if you had a domain named ilovecoffee.com and you wanted to point it to 212.1.212.65 as its IP address, you’d need to create A record entries that look like this:
It may look different to that of your registrar. Just fill in the similar values as shown in the image. The fields will be as follows – Name/Host, TTL, and Points to/Record.
The average Time To Live (TTL) value is 86400 seconds, which is 24 hours. When it comes to what you should set it as, look at other record entries. In this case, our DNS settings show 14400, which is 4 hours. 4 hours doesn’t exist in the Hostinger dropdown menu, so it’s advised to go with the average.
Once this step has been completed, you can move on to changing the MX record for email. Of course, this step is only required if you currently use the email server offered by your host.
This process is simple.
- Head to the MX record in the DNZ Zone and make note of the Points to field.
- Take that address and replace the MX record of your domain’s destination with the MX address of Hostinger.
The only different field here from the A record is Priority. This field determines the priority of each server you have. The lowest number represents the highest priority. If you only have the one server, it’s best to place a number between 0 and 5 into the priority field.
For additional help and guidance on DNS configuration settings, contact your web host. Many things, including accessing the DNS configurations, can be different depending on the host provider. Refrain from making major changes without receiving assistance.
Once you get the hang of things, making changes to your DNS configuration settings can be a simple and painless process.