Many friends may have problems in domain name resolution, such:
1. Why can't someone else open my website, but I cannot open it myself?
2. The domain name resolution has been changed and has not yet taken effect. What else do I need to do?
3. I want to move my website to another host, but I am worried aboutProgramOnce deployed on another host, the Website access andSeoWhat should I do?
I will answer the above questions: first, I will give you a brief explanation of the resolution process of the personal computer domain name request, and I will attach a solution to the above problems.
(1) During our Website access PC Opportunity first query host Hosts File. The file is located C:/Windows/system32/Drivers/etc The domain name and IP Address ing. When the file contains the corresponding domain name and IP When the address is in the corresponding relationship PC The machine reads the corresponding IP And start requesting the website page. We usually use Localhost And 127.0.0.1 It is a truth that can be parsed to the local server. Because by default, Hosts All files have Localhost And 127.0.0.1 This IP Corresponding to the address.
(2) Under normal circumstances, all of our website login needs to be dedicated DNS The server initiates a domain name resolution request. For example, China Unicom and China Telecom have their own dedicated DNS The server provides domain name resolution services for users. Of course, apart from DNS In addition, some servers provide domain name resolution services for free, such Google Of 8.8.8.8 And 8.8.4.4 . When we access the website PC Machine Hosts No domain name or IP Address ing, our PC The server initiates a request to the DNS server to resolve the domain name. When the DNS server receives a request to resolve the domain name, it returns the corresponding domain name to the user. IP Address information, the browser will IP Address to initiate a request to the target page.
(3) generally IP There is a certain degree of certainty in the correspondence between addresses in the same network environment, that is, the domain name and IP The address has a definite correspondence, so our PC Create one in the opportunity DNS Cache, this DNS The cache records the domain names and IP Address ing (this ing can be viewed through the command line, press and hold Win Press R , Input CMD , In the input Ipconfig/displaydns The domain name and IP Address ing, which includes DNS Cache and Local Machine Hosts The domain name and IP Address ing ). When you access the same domain name again DNS Read the corresponding domain name in the cache IP To accelerate the access to the target page. After introducing the entire process of domain name resolution, you may still not know how to solve the above problems. In fact, with this as the theoretical basis, solving the above problems will become much simpler, in addition, when you encounter similar problems in the future, you can quickly determine the reason why the domain name cannot be properly resolved. Okay, let's just talk about it.
Problem1: Why does my domain name take effect? Can someone else open my website, but I cannot open it myself?A: The reason is simple. The local disk is not refreshed.DNSCache.
Solution:Win + RInputInboundCMD, InputIpconfig/flushdnsRefreshDNSCache. Can I close all browsers and re-open them? It's amazing that the website is opened normally!
Problem2: The domain name resolution has changed and has not yet taken effect. What else do I need to do?A: Just like ourPCSame as machine,DNSRecursive servers also have caches,DNSServers updated globallyDNSThe cache time may be long.72Hours, usually in48Global resolution can be completed within hours, or even faster! It may take only a few seconds for a short time,This depends on the specific network environment. During this period, you can modifyHostsFile method to access your website. For more information, see3.
Problem3: I want to move the host to another host, but I am worried that the website program cannot be successfully deployed on another host, affecting Website access andSeoWhat should I do?
A: To solve this problem, I have carefully prepared a solution for you and can avoid this situation as much as possible. If you want to move your website to another host, but you want to change the domain name when the website is migrated, wait for it to take effect, and then test whether the website program can work normally. This will be very troublesome, what's more harmful is that if the website does not work normally after the domain name takes effect, it may also affect Website access and website Seo But it is impossible to change the domain name back to the original VM site in time, because the domain name takes effect in the global resolution, the longest may need 72 Hours. Okay. To solve the problem above, use the following method: Open C:/Windows/system32/Drivers/etc Find Hosts File, add a record Www.xxx.com XXX. XXX , The previous Www.xxx.com For your domain name, followed by your host's IP Address, add such a record and save it. If you are Win7 The system can copy the file, change it, and then paste and overwrite the original file. The system asks if the administrator needs to continue, and select continue. If your computer has a red umbrella or 360 Such software may prevent you from modifying Hosts File to temporarily disable or add trust to this type of software.
After adding such a record, you can open your browser and enter your domain name to resolve the domain name to the target hostIPAddress to access the target host. Note that such resolution is only generated on the local machineEffect, others still visit your website before modificationIPAddress.After that, you want to migrate the website and test the new website.