آغاز کار با CDN ابر آروان
After registering a domain in the ArvanCloud user panel, in the “Cloud DNS” -> “Records Management”, two new NS records will be specified for you by ArvanCloud. These NSs must be registered in your domain provider site. By doing this, the ArvanCloud CDN product will be completely activated in your site.
If you are concern about the smallest disconnections during transferring your website to ArvanCloud, we suggest that after registering the domain and defining your records (A, CNAME, MX, etc.) in Cloud DNS section, and adjusting the CDN settings in the Content Distribution Network (CDN) section in the ArvanCloud user panel, before changing the NS records, by following the steps below, first ensure of correctness and absence of any problem and error in uploading the site on ArvanCloud edge servers, and then try to change NS records.
First method: Manually setting the domain and IP address of ArvanCloud edge server in the hosts file.
When resolving a domain name to an IP address, the system first checks its local DNS file (hosts) before referring to the DNS server set for the gateway (modem). Therefore, by adding the domain name and IP address of ArvanCloud server to this file, the system refers to this IP directly and without referring to any DNS server outside of it.
To access this file on operating systems of Windows 8, 8.1, and 10, using the search section, search the word Notepad, and after displaying its icon, right-click on it and select Run as Administrator.
Then, click Open from the File menu, and in the opened window, enter the address of “c:\windows\system32\drivers\etc\hosts” in the File Name section and click Open:
At the end of this file, you can add the website name along with the IP address of ArvanCloud, 18.104.22.168 or 22.214.171.124, as the same format in the file (e.g. x.x.x.x example.com), and then save the file and close it.
After changing the host file, enter your website address in the Chrome browser and by pressing Ctrl + Shift + I go to the Developer Tools environment (Inspect Element environment in the Firefox browser). In the opened window, go to Network section and check the headers of your website and ensure that the site is uploading correctly and without any errors (SSL, cache, DNS, etc.). On the other hand, ensure that ArvanCloud specific headers have also been added and in what condition they are in (for more information on different caching statues and their meanings read the article of Examining ArvanCloud Cache Responses).
Open the Terminal window and enter the following command:
sudo nano /etc/hosts
After entering the command, if you are not in the root environment, the system will ask you for password. After entering the correct password, you can access the contents of hosts file. Then, in the hosts file, first enter the IP address of ArvanCloud, and then by pressing Tab, enter your domain name.
Finally, save these new settings by pressing Ctrl + X -> Y -> Enter.
In the terminal section, enter search and click on the Found icon (or open the Finder, and then go to “Utilities” -> “Application”, and select terminal). Then, enter the following command in terminal window:
sudo nano /private/etc/hosts
After entering this command, the system asks for the password (this is the same password that you use to login to the system), by entering the password, you can access the content of hosts file. Enter the ArvanCloud IP address along with your domain name in the hosts file and save these changes by pressing Ctrl + X. Using the following command, you can also clear the DNS cache and make the changes done to be applied quickly:
Note: In all three cases described above, after the test is completed, you can use “#” before the line you added to the hosts file so that the operating system ignores this line when referring to hosts file. Any time you needed to re-test and re-examine the main server of your website host, you can remove the # from the beginning of the line.
Second method: Using the Curl tool
By using the resolve–- option in the curl command, it will be specified for this command to request the URL mention in the command from the specified address instead of the DNS or the /etc/hosts file:
curl --resolve hostname:port:DESTINATIONIPADDRESS http(s)://www.example.com
Thus, instead of DESTINATIONIPADDRESS in the command above, enter the ArvanCloud IP address (126.96.36.199). Then, check the headers in the output shown, and ensure that ArvanCloud headers are added and there is no error.