It finally has its own domain name

20161113558020150107035434_dFJtQ.jpeg

Two-eleven everyone time to buy buy buy, there is a small yard farmers to be left quietly bought a domain name on Namecheap, completed the double hand chop eleven trip.

Chop hand trip reference to the new domain name registration Namecheap detailed tutorial , it is quite simple. But I use the domain name resolution is DNSPOD, does not resolve the domain name with Namecheap, so domestic use coding visit abroad with github access, you can speed up website access speed.

Github simple to set up, add a CNAME file in / hexo / source, notice is not required suffix, which is content to write nyami.com, do not write www. Then go to the page at github binding domain, DNS resolution, then I was so arranged:

20161113211692016-11-13_13-45-34.png

He said the following about the new issue binding domain of coding, I found it to be a big pit ah ~

I have direct access to the nyami.github.ioaddress will jump to nyami.com,
I direct access to the nyami.coding.mediscovery will not jump to nyami.comthe domain name, because I found a bit, the answer is as follows:

github only bind a domain, so access tengj.github.iotime, github servers know to tengj.topjump. coding can bind multiple domain names, when binding multiple domain names, access tengj.coding.me,codingserver do not know where to jump, so just do not jump up. But when a bind, why not jump, could be coding that trouble, you do not jump up. These are coding given, we can not change.

你先想一个问题:那么多人都要在github上搞博客,还要自定义域名。github哪来这么多ip给你们用?所以办法就是仅仅提供一个ip,这样必然导致这个服务器上发着所有人的博客文件,那么如何区分特定的域名应该展示谁的博客呢?答案就是在仓库里面新建一个CNAME文件,里面写上你博客想用的域名,github的服务器会根据当前http请求的Host头部(即域名),查找对应的包含相同的CNAME内容的目录,从而显示其中的页面。这就是为什么要在仓库里面创建一个CNAME原因。

不过,事情还没完,一个ip的问题是世界各地不同地点的访问速度不同,有些地方可能很慢,所以需要一组ip来分担一下。 大专栏  终于有自己的域名啦最早github好像只有2个ip,后来ip变多了。再后来,github支持域名解析的时候,通过alias来。比如在域名商那边设置成www.tengj.com ---> tengj.github.io,由于github无法控制你如何配置域名和ip的关系,但他可以控制tengj.github.io的最终ip解析,所以github推荐大家使用alias解析,可以为博主提供就近ip访问。这就是你在域名商那边配置CNAME或者alias的原理。这里的CNAME跟上面提到的CNAME作用不同,不是一个概念,不要混淆。

还有就是coding.me的现在是指向国外的,不像以前是指向国内的,我也是醉了~

要把博客同步到coding,首先要在coding里面新建一个与你Global Key(也就是个性后缀)一样的项目,然后修改博客根目录下面的_config.yml文件中的deploy如下(注意缩进):

2016111337932016-11-13_14-04-45.png

Like github and configuration ssh, not explained in detail the process relatively simple. More important, in the source / need to create a blank file, for reasons, because coding.net need to sign this document as a static file deployment. That saw this Staticfile know accordance with static files to publish.

1
2
cd source/
touch Staticfile

Then binding domain in the coding pages service, the attention branch must write master.

20161113140112016-11-13_14-16-35.png

Finally, go on DNSPOD set about DNS:

20161113755222016-11-13_14-20-33.png

Then it detects DNS is correct, domestic resolves to coding, foreign resolves to github, a lot of behind the foreign resolution is resolved to the United States Fastly companies CDN network nodes, this is the github resolution, so the domestic resolve is estimated that coding, though also directed abroad, ORZ.

20161113644562016-11-13_14-27-09.png

Guess you like

Origin www.cnblogs.com/lijianming180/p/12147699.html